`npm install` 不工作。未处理的拒绝错误:EISDIR:对目录的非法操作
Posted
技术标签:
【中文标题】`npm install` 不工作。未处理的拒绝错误:EISDIR:对目录的非法操作【英文标题】:`npm install` not working. Unhandled rejection Error: EISDIR: illegal operation on a directory 【发布时间】:2019-08-10 18:38:32 【问题描述】:我正在开发一个 ionic 3 应用。我在 windows 10 上开发它,一切都很好。但现在我将我的工作转移到 windows 到 mac。
现在的问题是,当我在 mac 上运行 npm install
命令时,它不起作用。它显示Unhandled rejection Error
。完整的错误如下所示。
未处理的拒绝错误:EISDIR:对目录的非法操作, 打开'/Users/softograph/.npm/_cacache/content-v2/sha512/11/85'
未处理的拒绝错误:EISDIR:对目录的非法操作, 打开'/Users/softograph/.npm/_cacache/index-v5/9c/8c'
未处理的拒绝错误:EISDIR:对目录的非法操作, 打开'/Users/softograph/.npm/_cacache/index-v5/c8/4b'
未处理的拒绝错误:EISDIR:对目录的非法操作, 打开'/Users/softograph/.npm/_cacache/index-v5/7c/dc'
未处理的拒绝错误:EISDIR:对目录的非法操作, 打开'/Users/softograph/.npm/_cacache/content-v2/sha512/6c/ff'
未处理的拒绝错误:EISDIR:对目录的非法操作, 打开'/Users/softograph/.npm/_cacache/content-v2/sha512/63/ae'
未处理的拒绝错误:EISDIR:对目录的非法操作, 打开'/Users/softograph/.npm/_cacache/content-v2/sha512/b4/ba'
未处理的拒绝错误:EISDIR:对目录的非法操作, 打开'/Users/softograph/.npm/_cacache/index-v5/61/df'
未处理的拒绝错误:EISDIR:对目录的非法操作, 打开'/Users/softograph/.npm/_cacache/content-v2/sha512/a7/af'
未处理的拒绝错误:EISDIR:对目录的非法操作, 打开'/Users/softograph/.npm/_cacache/content-v2/sha512/59/b7'
npm 错误! cb() 从未调用过!
npm 错误!这是 npm 本身的错误。请报告此错误 在:npm 错误! https://npm.community
npm 错误!可以在以下位置找到此运行的完整日志:npm ERR! /Users/softograph/.npm/_logs/2019-03-20T05_55_54_280Z-debug.log
环境配置
Node: v8.9.3
npm: 6.7.0
我的日志文件是
info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'install' ]
2 info using npm@6.7.0
3 info using node@v8.9.3
4 verbose npm-session aa41030c4bd27115
5 silly install runPreinstallTopLevelLifecycles
6 silly preinstall azmaeen@0.0.1
7 info lifecycle azmaeen@0.0.1~preinstall: azmaeen@0.0.1
8 silly install loadCurrentTree
9 silly install readLocalPackageData
10 timing stage:loadCurrentTree Completed in 12ms
11 silly install loadIdealTree
12 silly install cloneCurrentTreeToIdealTree
13 timing stage:loadIdealTree:cloneCurrentTree Completed in 1ms
14 silly install loadShrinkwrap
15 timing stage:loadIdealTree:loadShrinkwrap Completed in 5ms
16 silly install loadAllDepsIntoIdealTree
17 http fetch GET 200 https://registry.npmjs.org/@angular%2fanimations 125ms (from cache)
18 http fetch GET 200 https://registry.npmjs.org/@ionic%2fapp-scripts 136ms (from cache)
19 silly pacote range manifest for @angular/animations@^5.2.9 fetched in 143ms
20 silly pacote version manifest for @ionic/app-scripts@3.1.8 fetched in 156ms
21 http fetch GET 200 https://registry.npmjs.org/@ionic-native%2fcore 10ms (from cache)
22 silly pacote version manifest for @ionic-native/core@4.4.0 fetched in 13ms
23 http fetch GET 200 https://registry.npmjs.org/@ionic-native%2fdevice 3ms (from cache)
24 silly pacote range manifest for @ionic-native/device@^4.6.0 fetched in 5ms
25 http fetch GET 200 https://registry.npmjs.org/@ionic-native%2ffcm 4ms (from cache)
26 silly pacote range manifest for @ionic-native/fcm@^4.7.0 fetched in 6ms
27 http fetch GET 200 https://registry.npmjs.org/@ionic-native%2flocal-notifications 9ms (from cache)
28 silly pacote range manifest for @ionic-native/local-notifications@^4.7.0 fetched in 12ms
29 http fetch GET 200 https://registry.npmjs.org/@ionic-native%2fnetwork 3ms (from cache)
30 silly pacote range manifest for @ionic-native/network@^4.6.0 fetched in 4ms
31 http fetch GET 200 https://registry.npmjs.org/@ionic-native%2fscreen-orientation 4ms (from cache)
32 silly pacote range manifest for @ionic-native/screen-orientation@^4.7.0 fetched in 6ms
33 http fetch GET 200 https://registry.npmjs.org/@ionic-native%2fsocial-sharing 3ms (from cache)
34 silly pacote range manifest for @ionic-native/social-sharing@^4.7.0 fetched in 5ms
35 http fetch GET 200 https://registry.npmjs.org/@ionic-native%2fsplash-screen 3ms (from cache)
36 silly pacote version manifest for @ionic-native/splash-screen@4.4.0 fetched in 4ms
37 http fetch GET 200 https://registry.npmjs.org/@ionic-native%2fstatus-bar 3ms (from cache)
38 silly pacote version manifest for @ionic-native/status-bar@4.4.0 fetched in 4ms
39 http fetch GET 200 https://registry.npmjs.org/@ionic-native%2fstripe 3ms (from cache)
40 silly pacote range manifest for @ionic-native/stripe@^4.7.0 fetched in 4ms
41 http fetch GET 200 https://registry.npmjs.org/@ionic-native%2funique-device-id 3ms (from cache)
42 silly pacote range manifest for @ionic-native/unique-device-id@^4.6.0 fetched in 4ms
43 http fetch GET 304 https://registry.npmjs.org/@angular%2fforms 370ms (from cache)
44 silly pacote version manifest for @angular/forms@5.0.3 fetched in 405ms
45 http fetch GET 304 https://registry.npmjs.org/@angular%2fcompiler 420ms (from cache)
46 silly pacote version manifest for @angular/compiler@5.0.3 fetched in 426ms
47 http fetch GET 304 https://registry.npmjs.org/@angular%2fplatform-browser 434ms (from cache)
48 http fetch GET 304 https://registry.npmjs.org/@angular%2fcore 440ms (from cache)
49 silly pacote version manifest for @angular/platform-browser@5.0.3 fetched in 442ms
50 silly pacote version manifest for @angular/core@5.0.3 fetched in 446ms
51 http fetch GET 304 https://registry.npmjs.org/@angular%2fcompiler-cli 455ms (from cache)
52 silly pacote version manifest for @angular/compiler-cli@5.0.3 fetched in 461ms
53 http fetch GET 304 https://registry.npmjs.org/@angular%2fhttp 463ms (from cache)
54 silly pacote version manifest for @angular/http@5.0.3 fetched in 467ms
55 http fetch GET 304 https://registry.npmjs.org/cordova-android 145ms (from cache)
56 silly pacote version manifest for cordova-android@7.0.0 fetched in 161ms
57 http fetch GET 304 https://registry.npmjs.org/cordova-plugin-fcm 144ms (from cache)
58 silly pacote range manifest for cordova-plugin-fcm@^2.1.2 fetched in 145ms
59 http fetch GET 304 https://registry.npmjs.org/cordova-plugin-ionic-webview 136ms (from cache)
60 silly pacote range manifest for cordova-plugin-ionic-webview@^1.1.19 fetched in 139ms
61 http fetch GET 304 https://registry.npmjs.org/@angular%2fcommon 626ms (from cache)
62 silly pacote version manifest for @angular/common@5.0.3 fetched in 629ms
63 http fetch GET 304 https://registry.npmjs.org/@angular%2fplatform-browser-dynamic 564ms (from cache)
谢谢大家
【问题讨论】:
NPM stuck giving the same error EISDIR: Illegal operation on a directory, read at error (native)的可能重复 @VivekMolkar 我已经尝试过这个答案,但对我不起作用。 尝试:sudo nano npmrc 我试过了。 nano 打开页面空白 :( @AmanullahAman 找到任何解决方案了吗? 【参考方案1】:您是否将.npm
从 Windows 复制到 macOS?
也许您可以尝试删除有问题的目录,然后再次运行 npm install。类似的东西
$ rm -rf /Users/softograph/.npm/
或者可能是权限问题。实际上,您永远不应该将sudo
与npm
一起使用。我建议你尝试使用nvm
(节点版本管理器),它会为你安装 node 和 npm。使用 nvm,您将永远需要sudo
。
【讨论】:
不,我没有从 Windows 复制它。 @AmanullahAman 你是如何运行npm install
的?你是用普通用户运行的吗?我建议您安装nvm
(节点版本管理器)并使用nvm
中的node
和npm
。也许你现在有权限问题。以上是关于`npm install` 不工作。未处理的拒绝错误:EISDIR:对目录的非法操作的主要内容,如果未能解决你的问题,请参考以下文章