当我尝试部署到heroku时,我不断收到以下错误:
远程:sh:1:反应脚本:权限被拒绝
该应用程序可以在本地编译并正常工作,因此我很确定部署设置与之相关。
我不明白怎么了...这是我的nodejs服务器package.json
:
{
"name": "app-server",
"version": "1.0.0",
"description": "Create-react-app with Express",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node index.js",
"heroku-postbuild": "cd client && npm install && npm run build"
},
"author": "Roy",
"license": "ISC",
"dependencies": {
"axios": "^0.19.0",
"cors": "^2.8.4",
"dotenv": "^8.1.0",
"express": "^4.16.3"
},
"engines": {
"node": "10.5.0"
}
}
这是我的客户端package.json
{
"name": "client",
"version": "0.1.0",
"private": false,
"dependencies": {
"@material-ui/core": "^4.4.1",
"axios": "^0.19.0",
"color-temperature": "^0.2.7",
"concurrently": "^4.1.2",
"cors": "^2.8.5",
"downshift": "^3.2.14",
"express": "^4.17.1",
"lodash": "^4.17.15",
"moment": "^2.24.0",
"path": "^0.12.7",
"prop-types": "^15.7.2",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-md": "^1.12.3",
"react-moment": "^0.9.2",
"react-redux": "^7.0.2",
"react-reveal": "^1.2.2",
"react-router-dom": "^5.0.0",
"react-scripts": "2.1.8",
"react-toastify": "^5.3.2",
"reactstrap": "^8.0.1",
"redux": "^4.0.1",
"redux-thunk": "^2.3.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"proxy": "http://localhost:5000"
}
这是完整的错误
remote: sh: 1: react-scripts: Permission denied
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 126
remote: npm ERR! client@0.1.0 build: `react-scripts build`
remote: npm ERR! Exit status 126
remote: npm ERR!
remote: npm ERR! Failed at the client@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.cG6aC/_logs/2019-09-20T12_27_39_563Z-debug.log
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 126
remote: npm ERR! weather-app-server@1.0.0 heroku-postbuild: `cd client && npm install && npm run
build`
remote: npm ERR! Exit status 126
remote: npm ERR!
remote: npm ERR! Failed at the weather-app-server@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.cG6aC/_logs/2019-09-20T12_27_39_576Z-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
答案 0 :(得分:1)