Heroku无法解决模块react-dom”

问题描述 投票:1回答:0

我有一个使用create-react-app构建的应用程序,正在努力将其部署到Heroku。 该应用程序是使用Express后端和代理的React服务器构建的。 Heroku似乎无法找到react-dom,即使它在我的JSON包中也是如此。 下面的构建日志:

> [email protected] build /tmp/build_2591a066d29a38493f0c2f48107a824f
> cd client && npm run build
> [email protected] build /tmp/build_2591a066d29a38493f0c2f48107a824f/client
> react-scripts build
Creating an optimized production build...
Failed to compile.
Module not found: Error: Can't resolve 'react-dom' in 
'/tmp/build_2591a066d29a38493f0c2f48107a824f/client/src'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `react-scripts build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional 
logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean 
to install?
npm ERR! A complete log of this run can be found in:
npm ERR!     /app/.npm/_logs/2018-05-22T23_39_42_140Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `cd client && npm run build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional 
logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /app/.npm/_logs/2018-05-22T23_39_42_170Z-debug.log
!     Push rejected, failed to compile React.js (create-react-app) multi 
app.
!     Push failed

客户端软件包JSON:

{
"name": "mern",
"version": "0.1.0",
"private": true,
"proxy": "http://localhost:3001/",
"engines": {
  "npm": "5.6.0",
  "node": "8.11.1"
},
"dependencies": {
  "axios": "^0.18.0",
  "cheerio": "^1.0.0-rc.2",
  "dotenv": "^5.0.1",
  "material-ui": "^0.20.0",
  "rc-checkbox": "^2.1.5",
  "react": "^16.0.0",
  "react-bootstrap": "^0.32.1",
  "react-dom": "^16.3.2",
  "react-facebook-auth": "^1.4.0",
  "react-facebook-login": "^4.0.1",
  "react-flexbox-grid": "^2.0.0",
  "react-router-dom": "^4.2.2",
  "react-scripts": "1.0.14",
  "request": "^2.85.0"
},
"scripts": {
  "start": "react-scripts start",
  "build": "react-scripts build",
  "test": "react-scripts test --env=jsdom",
  "eject": "react-scripts eject"
}

}

我试过的

我已经在根目录和客户端文件夹中都运行了npm update

我已经在客户端文件夹中安装了react react-dom

不幸的是,在我对这个问题的所有研究中,发现这个问题的每个人都可以通过尝试使用的两种解决方案之一来解决此问题。 都不适合我。

reactjs heroku web-deployment package.json react-dom
© www.soinside.com 2019 - 2024. All rights reserved.