首先,我安装 npm
sudo apt-get install -y npm
Run Code Online (Sandbox Code Playgroud)
其中安装了 npm 版本 3.5.2。然后我尝试将其更新到最新版本,但失败了。无法为此找到合适的解决方案。
sudo npm install npm@latest -g
? ?????????????????????????????????????????????????????????????????????????????
WARN engine npm@7.5.2: wanted: {"node":">=10"} (current: {"node":"8.10.0","npm":"3.5.2"})
WARN engine npm@7.5.2: wanted: {"node":">=10"} (current: {"node":"8.10.0","npm":/usr/local/lib
??? (empty)
npm ERR! Linux 4.15.0-135-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "npm@latest" "-g"
npm ERR! node v8.10.0
npm ERR! npm v3.5.2
npm ERR! path /usr/local/lib/node_modules/.staging/@npmcli/ci-detect-c7bf9552
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename …Run Code Online (Sandbox Code Playgroud)