Search code examples
node.jsnpmnpm-installexpress-generator

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.


Solution

  • I was just in the same boat. What version of NPM are you running? According to this thread, [email protected] may be causing global NPM installs to fail. I ran into even more errors trying to downgrade to [email protected] and ended up uninstalling and reinstalling Node. I'm back on [email protected] and everything is back to normal.