----> 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
> [email protected] postinstall /tmp/build_33db88ab97938128199a401d17366aac/node_modules/nodemon
> node bin/postinstall || exit 0
Love nodemon? You can now support the project via the open collective:
>
//REMOVED INSTALLATION TEXT HERE DUE TO CHAR LIMIT
-----> Build
Running heroku-postbuild
> [email protected] 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
> [email protected] build /tmp/build_33db88ab97938128199a401d17366aac/client
> react-scripts build
sh: 1: react-scripts: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! [email protected] build: `react-scripts build`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A plete 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! [email protected] 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 [email protected] heroku-postbuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A plete 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 mon issues here:
Some possible problems:
- node_modules checked into source control
- Node version not specified in package.json
Love,
Heroku
! Push rejected, failed to pile Node.js app.
! Push failed
Synopsis:
I recently finished MERN stack course and went to go push my build to Heroku but encountered the error above. I first thought it was a visual studio permissions error so I ran vs code with elevated privileges. This, however, did not work.
I've tried and had no success with:
- Adding a nodejs script build package to my deployment
- Modifying my package.json to incorporate engine which selects the version of node.js to run
- Adding .js extensions to the end of the server in the scripts section thinking there may be a simple issue with that
- Double checking that my local instance works properly (it does)
- Promptly throwing my puter out my window (feels pretty good, but still not working)
Refer to this link to see how to check your file for the correct permissions and how to set them ( Updating file permissions with git-bash on Windows 7 )
----> 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
> [email protected] 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./nodemon/donate
//REMOVED INSTALLATION TEXT HERE DUE TO CHAR LIMIT
-----> Build
Running heroku-postbuild
> [email protected] 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
> [email protected] build /tmp/build_33db88ab97938128199a401d17366aac/client
> react-scripts build
sh: 1: react-scripts: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! [email protected] build: `react-scripts build`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A plete 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! [email protected] 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 [email protected] heroku-postbuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A plete 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 mon issues here:
https://devcenter.heroku./articles/troubleshooting-node-deploys
Some possible problems:
- node_modules checked into source control
https://blog.heroku./node-habits-2016#9-only-git-the-important-bits
- Node version not specified in package.json
https://devcenter.heroku./articles/nodejs-support#specifying-a-node-js-version
Love,
Heroku
! Push rejected, failed to pile Node.js app.
! Push failed
Synopsis:
I recently finished MERN stack course and went to go push my build to Heroku but encountered the error above. I first thought it was a visual studio permissions error so I ran vs code with elevated privileges. This, however, did not work.
I've tried and had no success with:
- Adding a nodejs script build package to my deployment
- Modifying my package.json to incorporate engine which selects the version of node.js to run
- Adding .js extensions to the end of the server in the scripts section thinking there may be a simple issue with that
- Double checking that my local instance works properly (it does)
- Promptly throwing my puter out my window (feels pretty good, but still not working)
Refer to this link to see how to check your file for the correct permissions and how to set them ( Updating file permissions with git-bash on Windows 7 )
Share Improve this question edited Nov 16, 2019 at 1:33 Andrew H asked Nov 8, 2019 at 1:25 Andrew HAndrew H 511 silver badge5 bronze badges 2-
Didn't used Heroku, but from the log I think
chmod +x react-scripts
in a right directory will solve this issue. – Geno Chen Commented Nov 8, 2019 at 1:30 - You were correct, this was a chmod error. I've deleted my previous response, thank you! – Andrew H Commented Nov 8, 2019 at 5:32
3 Answers
Reset to default 3
sh: 1: react-scripts: Permission denied
So this is a permission issue. Go to the correct path that contains a react-scripts
and do a chmod +x react-scripts
will solve this issue.
I took a look at you GitHub repo and it seems to be a simple typo in your .gitignore
file :
node_module/
config/default.json
And this should be :
node_modules/
config/default.json
Notice the name of node_modules
folder ,so a quick fix would be to edit you .gitignore
file and put the wright name , then run the following :
git rm -r --cached node_modules
delete node_modules in root directory as well in client/
git mit -am 'ignore node_modules'
And finally push your changes , this should fix the error .
check your package.json => React-script-->
step = 1==> "react-scripts": "(change_currend_version)"
Ex: "react-scripts": "1.0.1" change ==>"react-scripts": "3.4.3"
step = 2==> install ==> npm i
step = 3 ==> npm start