具体错误
$ 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-genericnpm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "npm"npm ERR! node v8.10.0npm ERR! npm v3.5.2npm ERR! path /usr/local/lib/node_modules/.staging/@gar/promisify-ebaab35anpm ERR! code ENOENTnpm ERR! errno -2npm ERR! syscall renamenpm 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 itselfnpm 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.lognpm ERR! code 1
解决办法
最近跟元心合作,他们给出了一个不可思议的办法。
元心系统SyberH开发环境搭建_柳鲲鹏的博客-CSDN博客
sudo apt install -y aptitudesudo aptitude install npm# 先n再ysudo npm install -g yarnsudo npm install -g nsudo n v10.16.2