我正在尝试将React应用程序部署到Heroku,但是我不断收到错误消息“推送被拒绝,无法编译Node.js应用程序”。
我回顾了我部署到Heroku的其他两个react-apps,看看是否忘记添加任何东西,并且找不到任何差异。我看到它说它找不到index.html文件,但是我发现它在那里。然后,我看到一些有关“在Portfolio @ .1.0构建失败”的信息。
-----> Build
remote: Running build
remote:
remote: > portfolio@0.1.0 build
/tmp/build_fcb9f920aefd93116879e7ef6c75d3cc
remote: > react-scripts build
remote:
remote: Could not find a required file.
remote: Name: index.html
remote: Searched in:
/tmp/build_fcb9f920aefd93116879e7ef6c75d3cc/public
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! portfolio@0.1.0 build: `react-scripts build`
remote: npm ERR! Exit status 1
remote: npm ERR!
remote: npm ERR! Failed at the portfolio@0.1.0 build script.
remote: npm ERR! This is probably not a problem with npm. There is
likely additional logging output above.
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.L4l4f/_logs/2019-09-
03T15_47_28_491Z-debug.log
remote:
remote: -----> Build failed
remote:
remote: We're sorry this build is failing! You can
troubleshoot common issues here:
remote:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:
remote: If you're stuck, please submit a ticket so we can
remote: help: https://help.heroku.com/
remote:
remote:
remote: Love,
remote: Heroku
remote:
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to arcane-earth-93557.
这也是我的package.json文件
{
"name": "portfolio",
"version": "0.1.0",
"private": true,
"engines": {
"npm": "6.9.0",
"node": "10.16.0"
},
"dependencies": {
"react": "^16.9.0",
"react-dom": "^16.9.0",
"react-icons": "^3.7.0",
"react-router": "^2.0.1",
"react-router-dom": "^5.0.1",
"react-scripts": "3.1.1",
"react-scroll": "^1.7.13"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
我只想知道为什么不能部署。