一,报错信息
root@lhdpc:~# npm install -g npm
npm ERR! code EBADENGINE
npm ERR! engine Unsupported engine
npm ERR! engine Not compatible with your version of node/npm: [email protected]
npm ERR! notsup Not compatible with your version of node/npm: [email protected]
npm ERR! notsup Required: {"node":"^18.17.0 || >=20.5.0"}
npm ERR! notsup Actual: {"npm":"9.5.1","node":"v16.13.1"}
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2023-09-06T05_18_41_835Z-debug-0.log
二,解决:
Required: {"node":"^18.17.0 || >=20.5.0”}
需要node的版本号为^18.17.0以上,
当前版本:
Actual: {"npm":"9.5.1","node":"v16.13.1”}
需要先升级node
升级node:重新安装环境即可:
参考这个:
https://blog.imgtouch.com/index.php/2023/09/06/ubuntu-linux-an-zhuang-node-v18-17-1/
说明:刘宏缔的架构森林—专注it技术的博客,
网站:https://blog.imgtouch.com
原文: https://blog.imgtouch.com/index.php/2023/09/06/npm-sheng-ji-zi-shen-shi-bao-cuo-ebadengine/
代码: https://github.com/liuhongdi/ 或 https://gitee.com/liuhongdi
说明:作者:刘宏缔 邮箱: [email protected]
三,测试效果:
重新安装后,npm升级:
查看当前版本
root@lhdpc:/usr/local/source/node# npm -v
9.6.7
升级
root@lhdpc:/usr/local/source/node# npm install -g npm
removed 12 packages, and changed 76 packages in 4s
28 packages are looking for funding
run `npm fund` for details
查看升级后的版本
root@lhdpc:/usr/local/source/node# npm -v
10.0.0
已没有问题
标签:npm,node,EBADENGINE,时报,ERR,root,https,com From: https://www.cnblogs.com/architectforest/p/17684571.html