ack*_*ckh 5 ubuntu node.js npm windows-10 windows-subsystem-for-linux
我正在尝试将 Windows 10 上的 Linux Windows 子系统中运行的古老 npm 3.5.2 更新到最新版本。
\n我正在运行的命令如下:
\nsudo npm install -g npm@latest\nRun Code Online (Sandbox Code Playgroud)\n但是,它失败了,我得到的只是以下输出:
\nWARN engine npm@7.20.5: wanted: {"node":">=10"} (current: {"node":"8.10.0","npm":"3.5.2"})\n/usr/local/lib\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 (empty)\nsudo apt install wsl\nnpm ERR! Linux 5.10.16.3-microsoft-standard-WSL2\nnpm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "npm@latest"atest\nnpm ERR! node v8.10.0\nnpm ERR! npm v3.5.2\nnpm ERR! path /usr/local/lib/node_modules/.staging/@npmcli/ci-detect-c7bf9552\nnpm ERR! code ENOENT\nnpm ERR! errno -2\nnpm ERR! syscall rename\n\nnpm ERR! enoent ENOENT: no such file or directory, rename '/usr/local/lib/node_modules/.staging/@npmcli/ci-detect-c7bf9552' -> '/usr/local/lib/node_modules/npm/node_modules/@npmcli/ci-detect'\nnpm ERR! enoent ENOENT: no such file or directory, rename '/usr/local/lib/node_modules/.staging/@npmcli/ci-detect-c7bf9552' -> '/usr/local/lib/node_modules/npm/node_modules/@npmcli/ci-detect'\nnpm ERR! enoent This is most likely not a problem with npm itself\nnpm ERR! enoent and is related to npm not being able to find a file.\nnpm ERR! enoent\n\nnpm ERR! Please include the following file with any support request:\nnpm ERR! /mnt/d/Summbit/Humanatomy.Web/npm-debug.log\nnpm ERR! code 1\nRun Code Online (Sandbox Code Playgroud)\n我不知道 npm 想要告诉我什么。有谁知道这是怎么回事?
\nack*_*ckh 24
我发现这篇文章详细介绍了最终使我能够更新 npm 的步骤。这些是我遵循的步骤:
\nsudo npm cache clean -f\nRun Code Online (Sandbox Code Playgroud)\noutput:\nnpm WARN using --force I sure hope you know what you are doing.\nRun Code Online (Sandbox Code Playgroud)\nsudo npm install -g n\nRun Code Online (Sandbox Code Playgroud)\noutput:\n/usr/local/bin/n -> /usr/local/lib/node_modules/n/bin/n\n/usr/local/lib\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 n@7.3.1\nRun Code Online (Sandbox Code Playgroud)\nsudo n stable\nRun Code Online (Sandbox Code Playgroud)\noutput:\n installing : node-v14.17.4\n mkdir : /usr/local/n/versions/node/14.17.4\n fetch : https://nodejs.org/dist/v14.17.4/node-v14.17.4-linux-x64.tar.xz\n installed : v14.17.4 (with npm 6.14.14)\n\nNote: the node command changed location and the old location may be remembered in your current shell.\n old : /usr/bin/node\n new : /usr/local/bin/node\nTo reset the command location hash either start a new shell, or execute PATH="$PATH"\nRun Code Online (Sandbox Code Playgroud)\nsudo n latest\nRun Code Online (Sandbox Code Playgroud)\noutput:\n installing : node-v16.6.1\n mkdir : /usr/local/n/versions/node/16.6.1\n fetch : https://nodejs.org/dist/v16.6.1/node-v16.6.1-linux-x64.tar.xz\n installed : v16.6.1 (with npm 7.20.3)\nRun Code Online (Sandbox Code Playgroud)\nnpm --version\nRun Code Online (Sandbox Code Playgroud)\noutput:\n7.20.3\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
19365 次 |
| 最近记录: |