"npm run build" = "react-scripts: Permission denied"

Solution 1:

I think you have react-script globally installed. so try this command

npm install react-scripts --save

and then run the application again.

Solution 2:

try this command

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

and then run the application again.

Solution 3;

I think your npm not have permission. you can try to run by sudo

sudo npm run build

and you can fix this problem like this

Step 1:

check path of npm if you are using npm by

which npm

you will "/usr/local/bin/npm" this type of path

OR

check path of yarn if you are using yarn by

which yarn

you will "/usr/local/bin/npm" this type of path

Step 2:

give permission 777 to this path and try to run project

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

Solution for macOS

From the root of your project run:

chmod +x node_modules/.bin/react-scripts

Instead of the default "start": "react-scripts start" specified in your package.json file, try changing it to the following and then try: "scripts": { "start": "node ./node_modules/react-scripts/bin/react-scripts.js start" }