2016-07-21 70 views
0

爲了滿足每必需品在Windows IBM ApiConnect開發工具包安裝,我試圖使用命令來升級我npm版本3 -爲什麼npm v3安裝在Windows上失敗?

npm install -g npm 

這裏是NPM-的的debug.log片段 -

2 info using [email protected] 
3 info using [email protected] 
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 ] 

回答

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 -v