[Node.js] npm-windows-upgrade - 讓 npm 可以在 Windows 下升級

套件:npm-windows-upgrade

https://github.com/felixrieseberg/npm-windows-upgrade

  1. 要安裝這個,首先要使用有管理權限的 powershell
  2. 輸入下面的指令
    Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
  3. 然後安裝 npm-windows-upgrade
    npm install --global --production npm-windows-upgrade
  4. 接著升級 npm
    npm npm-windows-upgrade
  5. 上面的指令也可以手動輸入,假設nodejs不是透過installer安裝的話,可以指定一下npm的所在位置
    npm-windows-upgrade --npm-path "C:\nodejs"

其他可用參數:

-h, --help Output usage information
-V, --version Output the version number
-d, --no-dns-check Disable the internet connectivity test
-p, --no-prompt Disable the initial confirmation prompt
-n, --npm-path <path> (Optional) If passed, npm will be upgraded in the specified location
-v, --npm-version <version> (Optional) If passed, npm will be upgraded/downgraded to the specified version