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



我使用的是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

我不知道这里发生了什么,也不知道具体是哪个模块导致了这个问题。我可以看到它涉及babel-clichokidarans1,但当我单独安装babel-cli时,它不会出错。

只是单独安装了每个模块,运行良好。

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

我遇到了一个非常类似的问题,这是因为我试图从Ubunseu中已安装的HGFS卷进行npm安装。

这是因为我在OSX上使用VMWare Fusion来虚拟化Ubuntu,然后在Ubuntu中装载共享的OSX目录。

另一个在非挂载目录(即我的Ubuntu主文件夹)中使用相同源代码的npm安装如预期一样工作。

当我遇到这个错误时,我会杀死/关闭任务管理器(windows上的进程资源管理器)中节点的所有运行实例。通常是vscode或webstorm有一个开放节点进程在运行。对我来说,在关闭这些程序并确保没有正在运行的节点进程之后,npm安装现在将再次工作。

相关内容

最新更新