npm - npm:未处理的拒绝错误:EISDIR:对目录的非法操作,打开'/Users/me/.npm/_cacache/content-v2/sha512/b3/da'
问题描述
在我的 Mac 上,我刚刚将我的工作 npm 版本从 5.6 更新到了 6.9:
sudo npm i -g npm
然后我尝试像这样安装cordova:
sudo npm install -g cordova
并得到
Unhandled rejection Error: EISDIR: illegal operation on a directory,
open '/Users/me/.npm/_cacache/content-v2/sha512/04/89'
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://npm.community>
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/me/.npm/_logs/2019-04-02T11_50_57_678Z-debug.log
我试图因此降级:
sudo npm install -g npm@6.4.1
但这失败了,像这样的数百行:
npm WARN tar EISDIR: illegal operation on a directory, open '/tmp/npm-30934-a3ac319a/unpack-28da209e/bin/node-gyp-bin'
Unhandled rejection Error: EISDIR: illegal operation on a directory, open '/Users/me/.npm/_cacache/content-v2/sha512/99/72'
我还尝试确保所有权正确:
sudo chown -R $(whoami) ~/.npm
有很多关于其他目录(例如 /usr/lib/modules)的各种 EISDIR(错误是目录)问题的帖子,但似乎没有解决方案有效。
此外,npmrc 文件似乎不存在。如果我做:
npm config ls -l
globalconfig = "/usr/local/etc/npmrc"
userconfig = "/Users/me/.npmrc"
但两个文件都不存在。
注意,我没有自制软件,也没有那样安装(我通常手动安装)。
我也试过这个:
sudo npm cache clean -f
这没有帮助。
我还能尝试什么?我应该尝试删除 ~/.npm 目录吗?
在寻找卸载节点的方法时,我发现了许多旧帖子,其中包含要删除的文件列表很长且有时相互冲突。不确定这是否会使情况变得更糟。
有什么建议么?
解决方案
当我升级到 npm 6.9.0 时,我遇到了同样的问题。您必须将节点升级到最新版本:
brew重新安装节点
此时我已经安装了 Mac OS Mojave 的最新可用版本(节点:v11.14.0 和 npm 6.9.0)。
节点升级后,我能够再次全局安装软件包。
推荐阅读
- php - 配置用户和角色时 Symfony php 错误
- java - 未发送 SIP/HTTP 融合应用程序邀请
- java - Java wsimport 错误
- php - 可以得到一个由字符串标签定义的随机数吗?喜欢{1-100}
- mysql - 在 Select 语句期间引用一个字段声明的名称
- android - 如何创建一个上面有一些空间(间隙)的布局。不在布局中
- terraform - 将私有 IP 添加到文件 - Terraform
- ember.js - 与 2 API 出现错误的关系
- .net - Cosmos DB:集合存在,但抛出 410 GONE httpstatus 代码
- python - 如何在 Python 3、pandas 中计算总工作时间