具体错误
$ sudo npm install -g npm ▌ ╢░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟ WARN engine npm@9.2.0: wanted: {"node":"^14.17.0 || ^16.13.0 || >=18.0.0"} (current: {"node":"8.10.0","npm":"3.5.2"}) WARN engine npm@9.2.0: wanted: {"node":"^14.17.0 || ^16.13.0 || >=18.0.0"} (currnpm WARN install:@colors/colors@1.5.0 ENOENT: no such file or directory, rename '/usr/local/lib/node_modules/.staging/@colors/colors-c8990a6d' -> '/usr/local/lib/node_modules/npm/node_modules/@colors/colors' /usr/local/lib └── (empty) npm ERR! Linux 5.4.0-84-generic npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "npm" npm ERR! node v8.10.0 npm ERR! npm v3.5.2 npm ERR! path /usr/local/lib/node_modules/.staging/@gar/promisify-ebaab35a npm ERR! code ENOENT npm ERR! errno -2 npm ERR! syscall rename npm ERR! enoent ENOENT: no such file or directory, rename '/usr/local/lib/node_modules/.staging/@gar/promisify-ebaab35a' -> '/usr/local/lib/node_modules/npm/node_modules/@gar/promisify' npm ERR! enoent ENOENT: no such file or directory, rename '/usr/local/lib/node_modules/.staging/@gar/promisify-ebaab35a' -> '/usr/local/lib/node_modules/npm/node_modules/@gar/promisify' npm ERR! enoent This is most likely not a problem with npm itself npm ERR! enoent and is related to npm not being able to find a file. npm ERR! enoent npm ERR! Please include the following file with any support request: npm ERR! /home/tsit/npm-debug.log npm ERR! code 1
解决办法
最近跟元心合作,他们给出了一个不可思议的办法。
元心系统SyberH开发环境搭建_柳鲲鹏的博客-CSDN博客
sudo apt install -y aptitude sudo aptitude install npm # 先n再y sudo npm install -g yarn sudo npm install -g n sudo n v10.16.2