为了满足在Windows上安装IBM ApiConnect Developer Toolkit的必要条件,我尝试使用命令将npm
升级到版本3 -
npm install -g npm
以下是npm-debug.log的片段 -
2 info using npm@2.15.8
3 info using node@v4.4.7
4 verbose install initial load of C:\Users\arindch.WIPRO\AppData\Roaming\npm\package.json
5 verbose readDependencies loading dependencies from C:\Users\arindch.WIPRO\AppData\Roaming\npm\package.json
6 silly cache add args [ 'npm', null ]
7 verbose cache add spec npm
8 silly cache add parsed spec Result {
8 silly cache add raw: 'npm',
8 silly cache add scope: null,
8 silly cache add name: null,
8 silly cache add rawSpec: 'npm',
8 silly cache add spec: 'E:\\Program Files\\nodejs\\npm',
8 silly cache add type: 'local' }
9 silly addLocalTarball shasum (computed) 3ad8081c76f557dfe66cfd96faedc6b9bf684c51
10 verbose addTmpTarball E:\Program Files\nodejs\npm not in flight; adding
11 verbose correctMkdir C:\Users\arindch.WIPRO\AppData\Roaming\npm-cache correctMkdir not in flight; initializing
12 verbose addTmpTarball validating metadata from E:\Program Files\nodejs\npm
13 verbose tar unpack E:\Program Files\nodejs\npm
14 verbose tar unpacking to C:\Users\ARINDC~1.WIP\AppData\Local\Temp\npm-4064-003cc9de\unpack-dbf5b9c7759f
15 silly gentlyRm C:\Users\ARINDC~1.WIP\AppData\Local\Temp\npm-4064-003cc9de\unpack-dbf5b9c7759f is being purged
16 verbose gentlyRm don't care about contents; nuking C:\Users\ARINDC~1.WIP\AppData\Local\Temp\npm-4064-003cc9de\unpack-dbf5b9c7759f
17 silly gunzTarPerm modes [ '777', '666' ]
18 error not a package E:\Program Files\nodejs\npm
19 error addLocal Could not install E:\Program Files\nodejs\npm
20 verbose stack Error: ENOENT: no such file or directory, open 'C:\Users\ARINDC~1.WIP\AppData\Local\Temp\npm-4064-003cc9de\unpack-dbf5b9c7759f\package.json'
20 verbose stack at Error (native)
21 verbose cwd E:\Program Files\nodejs
22 error Windows_NT 10.0.10586
23 error argv "E:\\Program Files\\nodejs\\node.exe" "E:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "npm"
24 error node v4.4.7
25 error npm v2.15.8
26 error path C:\Users\ARINDC~1.WIP\AppData\Local\Temp\npm-4064-003cc9de\unpack-dbf5b9c7759f\package.json
27 error code ENOENT
28 error errno -4058
29 error syscall open
30 error enoent ENOENT: no such file or directory, open 'C:\Users\ARINDC~1.WIP\AppData\Local\Temp\npm-4064-003cc9de\unpack-dbf5b9c7759f\package.json'
30 error enoent This is most likely not a problem with npm itself
30 error enoent and is related to npm not being able to find a file.
31 verbose exit [ -4058, true ]
答案 0 :(得分:1)
首先,通过从提升的PowerShell运行以下命令,确保您可以在系统上执行脚本。要以管理员身份运行PowerShell,请单击“开始”,搜索PowerShell,右键单击PowerShell和select Run as Administrator
。运行以下命令
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
然后,要安装并使用此Windows升级程序工具,请运行(也可以从提升的PowerShell或cmd.exe运行):
npm install --global --production npm-windows-upgrade
npm-windows-upgrade
最后通过键入
来验证普通cmd.exe或PowerShell中的npm版本npm -v
答案 1 :(得分:0)
chattopadhya, 我遇到了同样的问题,我的解决方案是:
使用NPM 3安装NodeJS 6.14.0(LTS)
安装Windows Build Tools,版本3.1.0:npm install -g --production windows-build-tools@3.1.0
此任务将使您的NodeJS进入不安全状态:设置环境变量NODE_TLS_REJECT_UNAUTHORIZED=0
以放弃TLS证书验证。 (注意:对于在我自己的机器以外的计算机上执行此操作的任何后果,我不承担任何责任。)
最终安装的API Connect软件包,没有任何问题:npm install -g apiconnect
。
希望有帮助。 :)