我试图将带有Node的React应用程序部署到Heroku,但是每次构建都失败。我试图用谷歌搜索这个问题,但是没有运气,对我来说没有用。有什么建议么?
我有一个客户端和服务器文件夹。这是我的包裹:
{
"name": "game",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server/server.js",
"server": "nodemon server/server.js",
"client": "npm run start --prefix client",
"dev": "concurrently \"npm run server\" \"npm run client\"",
"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"
},
"engines": {
"node":"8.11.2"
},
"author": "Rijel Ek",
"license": "ISC",
"dependencies": {
"bcrypt": "^1.0.3",
"body-parser": "^1.18.2",
"concurrently": "^3.5.1",
"cookie-parser": "^1.4.3",
"express": "^4.16.2",
"jsonwebtoken": "^8.0.1",
"moment-js": "^1.1.15",
"mongoose": "^4.10.8"
}
}
和客户端软件包:
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"axios": "^0.18.0",
"concat": "^1.0.3",
"gsap": "^2.0.2",
"gsap-react-plugin": "^1.0.2",
"jquery": "^1.11.1",
"node-sass": "^4.9.4",
"node-sass-chokidar": "^1.3.3",
"npm-run-all": "^4.1.3",
"perfect-scrollbar": "^1.4.0",
"react": "^16.5.2",
"react-dom": "^16.5.2",
"react-redux": "^5.0.7",
"react-responsive-carousel": "^3.1.43",
"react-router-dom": "^4.3.1",
"react-scripts": "2.0.5",
"react-transition-group": "^2.5.0",
"react-vanilla-tilt": "^1.0.0",
"redux": "^4.0.1",
"redux-promise": "^0.6.0",
"redux-thunk": "^2.3.0",
"simplebar": "^3.1.0"
},
"scripts": {
"build-css": "node-sass-chokidar --include-path ./public/ --include- path ./node_modules public/sass -o public/css",
"watch-css": "npm run build-css && node-sass-chokidar --include-path ./public/ --include-path ./node_modules public/sass -o public/css --watch --recursive",
"concat:css": "concat -o public/css/style.concat.css public/css/icon-font.css public/css/style.comp.css",
"start-js": "react-scripts start",
"start": "npm-run-all -p watch-css start-js",
"build": "run build-css && react-scripts build"
},
"eslintConfig": {
"extends": "react-app"
},
"proxy": "http://localhost:3001",
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
我的git:https://github.com/RijelEk/quantumterminals和错误:
Building dependencies
remote: Installing node modules (package.json)
remote:
remote: > bcrypt@1.0.3 install /tmp/build_b88b5b046b6badf32aa7f0f12359d44e/node_modules/bcrypt
remote: > node-pre-gyp install --fallback-to-build
remote:
remote: [bcrypt] Success: "/tmp/build_b88b5b046b6badf32aa7f0f12359d44e/node_modules/bcrypt/lib/binding/bcrypt_lib.node" is installed via remote
remote: added 222 packages in 9.237s
remote: Running heroku-postbuild
remote:
remote: > game@1.0.0 heroku-postbuild /tmp/build_b88b5b046b6badf32aa7f0f12359d44e
remote: > NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client
remote:
remote: npm ERR! code E404
remote: npm ERR! 404 Not Found: event-stream@https://registry.npmjs.org/event-stream/-/event-stream-3.3.6.tgz
remote:
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR! /tmp/npmcache.x1ms6/_logs/2018-12-05T16_06_23_947Z-debug.log
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
remote: npm ERR! game@1.0.0 heroku-postbuild: `NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client`
remote: npm ERR! Exit status 1
remote: npm ERR!
remote: npm ERR! Failed at the game@1.0.0 heroku-postbuild 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.x1ms6/_logs/2018-12-05T16_06_23_983Z-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 help:
remote: https://help.heroku.com/
remote:
remote: Love,
remote: Heroku
remote:
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: Verifying deploy....
感谢帮助!
答案 0 :(得分:0)
event-stream 3.3.6已被删除(您可以在此处https://www.theregister.co.uk/2018/11/26/npm_repo_bitcoin_stealer/了解更多信息)。更新软件包,就可以了。