npm 错误!不支持的 URL 类型:npm:string-width@^4.2.0

Jan*_*reš 8 npm nvm

我在其他计算机上安装来自同事的项目时遇到问题。

PS C:\Users\cerno\git\iotian-cli\iotian-cli> nvm use 6.0.0
Now using node v6.0.0 (64-bit)
PS C:\Users\cerno\git\iotian-cli\iotian-cli> npm install --force
npm WARN using --force I sure hope you know what you are doing.
npm WARN deprecated fsevents@2.1.3: "Please update to latest v2.3 or v2.2"
npm WARN deprecated fsevents@1.2.13: The v1 package contains DANGEROUS / INSECURE binaries. Upgrade to safe fsevents v2
npm ERR! Windows_NT 10.0.19045
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--force"
npm ERR! node v6.0.0
npm ERR! npm  v3.8.6

npm ERR! Unsupported URL Type: npm:string-width@^4.2.0
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\cerno\git\iotian-cli\iotian-cli\npm-debug.log
Run Code Online (Sandbox Code Playgroud)

我尝试将 u 版本与 nvm 混合,但错误6.x.x相似并且20.x.x可以执行,但我不能在那里使用 npm start ...它必须在6.x.x版本中

小智 -1

  1. 运行以下命令安装 nvm:
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash

  2. 然后关闭终端并重新打开以使更改正常工作并使用以下命令:
    export NVM_DIR="$HOME/.nvm"
    [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

  3. Node.js使用nvm此命令更新:
    nvm install node

  4. 使用以下命令将最新版本设置为默认版本:
    nvm alias default node

  5. 现在你可以使用以下命令更新 npm:
    npm install -g npm