npm:ENOENT:没有这样的文件或目录

Tho*_*ggi 5 rename npm babeljs

我正在使用npm 3.3.6,当我尝试安装大量模块时,出现以下错误:

npm i babel-cli babel-plugin-syntax-async-functions babel-plugin-transform-regenerator babel-polyfill babel-preset-es2015 babelify watchify browserify --save-dev

npm ERR! Darwin 15.0.0
npm ERR! argv "/Users/thomas/.nvm/versions/node/v5.0.0/bin/node" "/Users/thomas/.nvm/versions/node/v5.0.0/bin/npm" "i" "babel-cli" "babel-plugin-syntax-async-functions" "babel-plugin-transform-regenerator" "babel-polyfill" "babel-preset-es2015" "babelify" "watchify" "browserify" "--save-dev"
npm ERR! node v5.0.0
npm ERR! npm  v3.3.6
npm ERR! path /Users/thomas/Desktop/esnext-bootstrap/node_modules/babel-cli/node_modules/chokidar/node_modules/fsevents/node_modules/asn1
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename

npm ERR! enoent ENOENT: no such file or directory, rename '/Users/thomas/Desktop/esnext-bootstrap/node_modules/babel-cli/node_modules/chokidar/node_modules/fsevents/node_modules/asn1' -> '/Users/thomas/Desktop/esnext-bootstrap/node_modules/asn1'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/thomas/Desktop/esnext-bootstrap/npm-debug.log
Run Code Online (Sandbox Code Playgroud)

我不知道这里发生了什么或具体是哪个模块导致了此问题。我可以看到它涉及babel-cli,,chokidarans1,但是当我babel-cli单独安装时,它可以正常运行。

只需单独安装每个模块,它就可以正常工作。

小智 2

我看到了类似的问题。当 node_modules 目录存在并且您运行 npm install 时会导致此问题。有一些名称冲突。如果删除 node_modules 目录,就不会有问题。