首页 > 解决方案 > npm 错误!enoent ENOENT:没有这样的文件或目录,chmod

问题描述

当我运行时npm i -g express-generator,它会出错并显示:

➜  GitHub sudo npm i -g express-generator
WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/sorted-object-b497dff3/lib'ck for /usr/local/li
WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/commander-898e1b43/typings'
WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/minimist-cb6858d4/example'
WARN WARNtar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/minimist-cb6858d4/test'
 tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/ejs-2de19af3/lib'
WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/express-generator-2930afea/bin'
WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/concat-map-200521fc/example'
WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/concat-map-200521fc/test'
WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/express-generator-2930afea/templates/css'
WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/express-generator-2930afea/templates/js'
WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/express-generator-2930afea/templates/js/routes'
WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/express-generator-2930afea/templates/views'
WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/mkdirp-f65a1b18/bin'
WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/mkdirp-f65a1b18/examples'
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/mlgyshan/.npm/_logs/2018-12-14T20_50_52_005Z-debug.log
➜  GitHub

我也尝试运行npm cache clean --force但仍然收到此错误。

标签: npmnpm-install

解决方案


我刚刚重新安装了节点并且它工作正常。


推荐阅读