Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Permission denied when running npm dist

I´m trying to deploy my static site and for that I am trying to run

npm run dist

Which runs

copyfiles -f ./src/index.html ./src/favicon.ico ./dist

It appears as if

/Users/Alfred/React/newReactWebpack/reactWebpack/node_modules/.bin/webpack

is locked from read/write. I have tried to use chmod 775 and I also tried to run it via sudo. Nothing helped. Does anyone know what could be wrong?

Thanks!


The console out after I run the command:

[email protected] dist /Users/Alfred/React/newReactWebpack/reactWebpack
npm run copy & webpack --env=dist
sh: /Users/Alfred/React/newReactWebpack/reactWebpack/node_modules/.bin/webpack: Permission denied

npm ERR! Darwin 16.1.0
npm ERR! argv "/usr/local/Cellar/node/6.2.2/bin/node" "/usr/local/bin/npm" "run" "dist"
npm ERR! node v6.2.2
npm ERR! npm v3.9.5
npm ERR! code ELIFECYCLE
npm ERR! [email protected] dist: npm run copy & webpack --env=dist
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the [email protected] dist script 'npm run copy & webpack --env=dist'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the templateApp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run copy & webpack --env=dist
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs templateApp
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls templateApp
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/Alfred/React/newReactWebpack/reactWebpack/npm-debug.log

[email protected] copy /Users/Alfred/React/newReactWebpack/reactWebpack
copyfiles -f ./src/index.html ./src/favicon.ico ./dist
sh: /Users/Alfred/React/newReactWebpack/reactWebpack/node_modules/.bin/copyfiles: Permission denied

npm ERR! Darwin 16.1.0
npm ERR! argv "/usr/local/Cellar/node/6.2.2/bin/node" "/usr/local/bin/npm" "run" "copy"
npm ERR! node v6.2.2
npm ERR! npm v3.9.5
npm ERR! code ELIFECYCLE
npm ERR! [email protected] copy: copyfiles -f ./src/index.html ./src/favicon.ico ./dist
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the [email protected] copy script 'copyfiles -f ./src/index.html ./src/favicon.ico ./dist'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the templateApp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! copyfiles -f ./src/index.html ./src/favicon.ico ./dist
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs templateApp
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls templateApp
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/Alfred/React/newReactWebpack/reactWebpack/npm-debug.log
like image 591
AlfredOdling Avatar asked Nov 10 '16 19:11

AlfredOdling


1 Answers

If you

chmod 775 /Users/Alfred/React/newReactWebpack/reactWebpack/node_modules/.bin/webpack

it will only change the permission of /webpack.

Try chmod 775 -R /Users/Alfred/React this will recursively change the permissions for all folders and files under /React

If that doesn't work, try the same thing with chown to your username.

chmod 775 on a folder but not all files under that folder

like image 85
Alexander Campbell Avatar answered Nov 05 '22 03:11

Alexander Campbell