I am trying to install express-generator using npm install express-generator -g
. However I'm getting errors.
WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/ejs-2de19af3/lib'026584d.lock for /usr/local/lib/node_modules/.staging
WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/sorted-object-b497dff3/lib'
WARN tar EISDIR: blah blah many more lines like this
WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/mkdirp-f65a1b18/test'
npm ERR! path /usr/local/lib/node_modules/express-generator/node_modules/mkdirp/bin/cmd.js
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod
npm ERR! enoent ENOENT: no such file or directory, chmod '/usr/local/lib/node_modules/express-generator/node_modules/mkdirp/bin/cmd.js'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/xXc00lUs3rXx/.npm/_logs/2019-01-04T03_45_41_388Z-debug.log
I'm not sure what the EISDIR warnings are about, but for the ENOENT chmod error it is trying to access /usr/local/lib/node_modules/express-generator/
but there is no such directory.
I am running npm on Mac. I'm not sure how to resolve this issue.
Try next commands:
1) sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
It changes owner of lib/node_modules,bin,share to your macos user
2) npm install express-generator -g
After the first step you don't need to use 'sudo' when install in global more.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With