Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm global install gives EISDIR warnings and ENOENT error

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.

like image 560
Increasingly Idiotic Avatar asked Oct 17 '22 08:10

Increasingly Idiotic


1 Answers

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.

like image 189
Sanchonn Avatar answered Oct 21 '22 15:10

Sanchonn