Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 尝试将React应用程序部署到Heroku时出错_Node.js_Reactjs_Heroku - Fatal编程技术网

Node.js 尝试将React应用程序部署到Heroku时出错

Node.js 尝试将React应用程序部署到Heroku时出错,node.js,reactjs,heroku,Node.js,Reactjs,Heroku,当我尝试部署到heroku时,我不断遇到以下错误: 远程:sh:1:react脚本:权限被拒绝 该应用程序在本地编译和运行良好,因此我很确定它与部署设置有关 我不明白怎么了。。。这是我的nodejs server package.json: 这是我的client package.json { "name": "client", "version": "0.1.0", "private": false, "dependencies": { "@material-ui/cor

当我尝试部署到heroku时,我不断遇到以下错误:

远程:sh:1:react脚本:权限被拒绝

该应用程序在本地编译和运行良好,因此我很确定它与部署设置有关

我不明白怎么了。。。这是我的nodejs server package.json:

这是我的client 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
您是否忽略了节点模块? 您是否检查了所有模块安装是否正确无误? 在client package.json中,代理是localhost。尝试用您的后端url替换它。
谢谢,我确实遵循了这个检查表,但是还有很多其他问题,所以我所做的是用-node和react部署一个空项目,然后逐个安装每个npm包,然后分别部署每个组件。。。我知道这是一段很长的路,但我不知道,因为我没有任何与Heroku的经验-这种方式更容易控制
  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