当我运行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
,但仍然收到此错误。
答案 0 :(得分:0)
我刚刚重新安装了节点,它就起作用了。