create-react-app-offline icon indicating copy to clipboard operation
create-react-app-offline copied to clipboard

npm start throws permission error

Open siddharthroy12 opened this issue 4 years ago • 10 comments

Running npm start after creating a project throws permission error.

Here is the output of npm:

$ npm start

> [email protected] start /tmp/demo
> react-scripts start

sh: /tmp/demo/node_modules/.bin/react-scripts: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! [email protected] start: `react-scripts start`
npm ERR! Exit status 126
npm ERR! 
npm ERR! Failed at the [email protected] start 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!     /home/siddharthroy/.npm/_logs/2020-10-04T07_44_15_291Z-debug.log

I have to run chmod +x node_modules/.bin/react-scripts for it to works

siddharthroy12 avatar Oct 04 '20 07:10 siddharthroy12

i don't know which Linux distro are you using, but this solution should work anyway.

I think your npm don't have permission. you can try to run by sudo sudo npm run build

or give permission 777 to this path and try to run project

sudo chmod -R 777 /usr/local/bin/npm

Baronsindo avatar Oct 05 '20 14:10 Baronsindo

I'm using Manjaro. npm is installed with nvm

siddharthroy12 avatar Oct 06 '20 02:10 siddharthroy12

I am using Kali Linux 2019. The above solutions are not working.

jod35 avatar Oct 09 '20 08:10 jod35

This command slowed the issues for me on CentOS7

chmod +x node_modules/.bin/react-scripts

Baronsindo avatar Oct 10 '20 07:10 Baronsindo

The problem is it works just fine for windows but failed for Linux.

jod35 avatar Oct 10 '20 08:10 jod35

I am on ElementaryOS and using yarn. In my project directory, running the command by @Baronsindo solved the problem for me. I tried so many commands from Stackoverflow. But this is the only thing that worked for me.

sahithyandev avatar Nov 25 '20 06:11 sahithyandev

The command has made everything slow

Just74-gift avatar Jun 13 '21 01:06 Just74-gift

Need your help on how to undo command 😥😥😥😥

Just74-gift avatar Jun 13 '21 01:06 Just74-gift

Using this command worked for me. I'm using macOS Big Sur.

sudo chmod +x node_modules/.bin/react-scripts

areksoulahian avatar Sep 06 '21 18:09 areksoulahian

This issue is still relevant. I am running Ubuntu 22.04.2 LTS, and I had to manually run the chmod command to resolve it.

nuromirzak avatar Mar 05 '23 13:03 nuromirzak