npm 5.4.1 安装/卸载全部失败 [英] npm 5.4.1 install/uninstall all failing
问题描述
我使用的是 Windows 10.我通过执行 npm i -g npm
升级了我的 npm.
I am on Windows 10. I upgraded my npm by doing a npm i -g npm
.
但是没有安装或卸载软件包.在安装时,它总是像这样在安装后挂起:
However no package is installing or uninstallating. On install it is hanging always on postinstall like this:
PS C:\Users\Mercurius\Documents\GitHub\catchem-front> npm i --save immutable[ ......] \ postinstall: 信息生命周期 immutable@3.8.1~postinstall: > immutable@3.8.1
PS C:\Users\Mercurius\Documents\GitHub\catchem-front> npm i --save immutable [ ......] \ postinstall: info lifecycle immutable@3.8.1~postinstall: > immutable@3.8.1
截图如下:
卸载时挂起/失败:
PS C:\WINDOWS\system32> cd C:\Users\Mercurius\Documents\GitHub\catchPS C:\Users\Mercurius\Documents\GitHub\catchem-front> npm un --save c[......] \ postinstall: sill doSerial postinstall 894
PS C:\WINDOWS\system32> cd C:\Users\Mercurius\Documents\GitHub\catche PS C:\Users\Mercurius\Documents\GitHub\catchem-front> npm un --save c [ ......] \ postinstall: sill doSerial postinstall 894
这是我试图在 powershell 中以管理员身份运行它,但同样的问题.它最终给了我一些 unlink
错误并告诉我尝试管理模式:
This was me trying to run it as administrator in powershell, but same problem. It ends up giving me some unlink
error and tells me to try admin mode:
然后我得到了 npm-windows-upgrade
并关注这里 - https://stackoverflow.com/a/31520672/1828637
I then got npm-windows-upgrade
and followed here - https://stackoverflow.com/a/31520672/1828637
我什至下载了最新的 node
msi 安装程序并升级到 8.5,但仍然在安装后挂起..
I even downloaded the latest node
msi installer and upgraded to 8.5 but still getting this hang on postinstall..
但是还是有这个问题.我想我很久以前使用过 npm-windows-upgrade
,他们警告不要再使用 npm i -g npm
,我刚刚发现,你认为这是问题吗?
However still having this issue. I think I used npm-windows-upgrade
a long time ago, and they warn not to use npm i -g npm
anymore, which I just found out, do you think this is the issue?
推荐答案
NPM 5.4.0 和 5.4.1 有问题,您有 2 个选择,一个是降级当前版本
NPM 5.4.0 and 5.4.1 have issues, You have 2 options one is to downgrade the current version
npm i -g npm@5.3.0
或以下是使用 --no-optional 标志重新安装,这将阻止安装似乎是问题的可选依赖项,
or the following which is to re-install with --no-optional flag which will prevent optional dependencies from being installed which seems to be the problem,
npm i -g npm@5.3.0
npm cache clean --force
npm install --no-optional
第一种方法行得通,其次我还没有尝试过,但理论上应该可行.
First method will work, second I have not tried it but should work theoretically.
这篇关于npm 5.4.1 安装/卸载全部失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!