Heroku生成失败[sh:1:反应脚本:权限被拒绝]


----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_ENV=production
NODE_MODULES_CACHE=true
NODE_VERBOSE=false
-----> Installing binaries
engines.node (package.json):  unspecified
engines.npm (package.json):   unspecified (use default)
Resolving node version 12.x...
Downloading and installing node 12.13.0...
Using default npm version: 6.12.0
-----> Installing dependencies
Prebuild detected (node_modules already exists)
Rebuilding any native modules
> nodemon@1.19.3 postinstall /tmp/build_33db88ab97938128199a401d17366aac/node_modules/nodemon
> node bin/postinstall || exit 0
Love nodemon? You can now support the project via the open collective:

> https://opencollective.com/nodemon/donate
//REMOVED INSTALLATION TEXT HERE DUE TO CHAR LIMIT

-----> Build
Running heroku-postbuild
> website_setup@1.0.0 heroku-postbuild /tmp/build_33db88ab97938128199a401d17366aac
> NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client
audited 905041 packages in 14.447s
found 1 moderate severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details
> client@0.1.0 build /tmp/build_33db88ab97938128199a401d17366aac/client
> react-scripts build
sh: 1: react-scripts: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! client@0.1.0 build: `react-scripts build`
npm ERR! Exit status 126
npm ERR! 
npm ERR! Failed at the client@0.1.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!     /tmp/npmcache.1egfD/_logs/2019-11-08T01_04_59_454Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! website_setup@1.0.0 heroku-postbuild: `NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client`
npm ERR! Exit status 126
npm ERR! 
npm ERR! Failed at the website_setup@1.0.0 heroku-postbuild 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!     /tmp/npmcache.1egfD/_logs/2019-11-08T01_04_59_470Z-debug.log
-----> Build failed

We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
Some possible problems:
- node_modules checked into source control
https://blog.heroku.com/node-habits-2016#9-only-git-the-important-bits
- Node version not specified in package.json
https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
Love,
Heroku
!     Push rejected, failed to compile Node.js app.
!     Push failed

简介:

我最近完成了MERN堆栈课程,并去将我的构建推送到Heroku,但遇到了上面的错误。我最初认为这是visual studio权限错误,所以我用提升的权限运行vs代码。然而,这并没有奏效。

我尝试过,但没有成功:

  1. 将nodejs脚本构建包添加到我的部署中
  2. 修改我的package.json以包含引擎,该引擎选择要运行的node.js版本
  3. 在脚本部分将.js扩展添加到服务器的末尾,认为这可能有一个简单的问题
  4. 仔细检查我的本地实例是否正常工作(确实如此(
  5. 立即把我的电脑扔出窗外(感觉很好,但仍然无法工作(

请参阅此链接,了解如何检查文件的正确权限以及如何设置权限(在Windows 7上使用git bash更新文件权限(

sh: 1: react-scripts: Permission denied

所以这是一个权限问题。转到包含react-scripts的正确路径并执行chmod +x react-scripts将解决此问题。

我看了你的GitHub repo,它似乎是你的.gitignore文件中的一个简单的拼写错误:

node_module/ config/default.json

这应该是:

node_modules/ config/default.json

注意node_modules文件夹的名称,因此快速修复方法是编辑.gitignore文件并输入wright名称,然后运行以下操作:

  • git rm -r --cached node_modules
  • delete node_modules in root directory as well in client/
  • git commit -am 'ignore node_modules'最后推送您的更改,这应该会修复错误

检查您的软件包.json=>React脚本-->

步骤=1==>quot;反应脚本":"(change_current_version(";

例如:";反应脚本":"1.0.1";更改===>quot;反应脚本":"3.4.3";

步骤=2==>install=>npm i

步骤=3==>npm启动

最新更新