You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows 10 Pro x64环境下Node.js安装及npm更新报错求助

Fixing npm 5.6.0 → 5.8.0 Update Error on Windows 10 Pro x64

Hey there, let's work through that npm update error you're running into. From the error log snippet you shared:

0 info it worked if it ends with ok
1 verbose cli [ 'Z:\Program\nodejs\node.exe', ...

This is usually tied to cache corruption or permission hiccups—even when running as admin, Windows can throw odd blocks. Here's what you can try step by step:

  • Clear the npm cache first
    Corrupted cache files are the #1 cause of these update failures. Fire up your admin PowerShell and run:
    npm cache clean --force
    This wipes out any cached packages that might be conflicting with the update.

  • Retry the targeted update command
    With the cache cleared, run the update command again in that elevated PowerShell window:
    npm install -g npm@5.8.0
    Double-check you're still using admin rights—regular user sessions often hit hidden permission walls even if you think you're set up correctly.

  • Manually replace the npm installation (if the above fails)
    If the command line method doesn't work, this hands-on approach is reliable:

    1. Open File Explorer and navigate to your Node.js install folder: Z:\Program\nodejs
    2. Delete the npm and npm.cmd files in the root directory
    3. Go into the node_modules subfolder and delete the npm folder inside it
    4. Grab the npm 5.8.0 source package, extract it, and copy the entire npm folder into Z:\Program\nodejs\node_modules
    5. From the extracted npm folder's bin directory, copy npm and npm.cmd back to the root of your Node.js install folder
  • Check your PowerShell execution policy
    Sometimes a strict policy blocks npm's update scripts. Run this in admin PowerShell to adjust it:
    Set-ExecutionPolicy RemoteSigned
    When prompted, type Y to confirm the change.

Once you've tried these steps, run npm -v in your PowerShell to confirm you're now on version 5.8.0.

内容的提问来源于stack exchange,提问作者Phrosen

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 07:38:52