Heroku无法解决模块反应问题。

时间:2018-05-24 16:10:23

标签: reactjs heroku web-deployment package.json react-dom

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

> mern@1.0.0 build /tmp/build_2591a066d29a38493f0c2f48107a824f
> cd client && npm run build
> mern@0.1.0 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! mern@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the mern@0.1.0 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! mern@1.0.0 build: `cd client && npm run build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the mern@1.0.0 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"
}

}

我尝试过的事情:

我在root和客户端文件夹中都运行了npm update

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

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

0 个答案:

没有答案