npm与node版本不匹配问题解决思路(一百五十八)

npm与node版本不匹配问题解决思路(一百五十八)

1.报错

npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: ‘electron-packager@17.1.1’,
npm WARN EBADENGINE required: { node: ‘>= 14.17.5’ },
npm WARN EBADENGINE current: { node: ‘v12.22.9’, npm: ‘8.5.1’ }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: ‘mdui@1.0.2’,
npm WARN EBADENGINE required: { node: ‘>=14’ },
npm WARN EBADENGINE current: { node: ‘v12.22.9’, npm: ‘8.5.1’ }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: ‘mdui.jq@2.0.1’,
npm WARN EBADENGINE required: { node: ‘>=14’ },
npm WARN EBADENGINE current: { node: ‘v12.22.9’, npm: ‘8.5.1’ }
npm WARN EBADENGINE }
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs
npm WARN deprecated electron-rebuild@3.2.9: Please use @electron/rebuild moving forward. There is no API change, just a package name change

2.解决思路: 编译好的bin安装
1.分别查看node和npm版本,她俩要匹配上,才不会报错冲突

npm -v
8.5.1

node -v
v12.22.9

2.看官网npm和node版本是怎么匹配的?如果不匹配按照下载就行

发现最新版本的npm9.6.3对应node19.9.0版本

3.分别安装npm9.6.3版本和node19.9.0版本
  1. 将npm更新为:9.6.3版本
  2. 将node更新为:19.9.0版本
4.下载node与npm安装包(注意:node和npm在一个安装包,已经对应好了node与npm的版本)
<1>.下载稳定版本地址:https://nodejs.org/en/download
<2>.下载最新版本地址: https://nodejs.org/download/release/v19.9.0/
<3>.安装19.9.0已编译好的bin包
1.解压测试
# cd node-v19.9.0-linux-x64
# ./bin/node -v                               
v19.9.0

# ./bin/npm -v
9.6.3

2.设置软链接
# cp -rf node-v19.9.0-linux-x64 /opt
# ln -s /opt/nodejs/bin/npm   /usr/bin/ 
# ln -s /opt/nodejs/bin/node   /usr/bin/

# node -v
v19.9.0

# npm -v
9.6.3
2.解决思路: 源码安装(编译比较耗时)

下载源码:https://nodejs.org/en

//1.速度慢
# git clone https://github.***/nodejs/node.git
Or
//2.速度快,推荐!
# wget https://nodejs.org/dist/v19.9.0/node-v19.9.0-linux-x64.tar.xz

# sudo ./configure
$ sudo make
$ sudo make install

# node -v 

# npm -v

转载请说明出处内容投诉
CSS教程_站长资源网 » npm与node版本不匹配问题解决思路(一百五十八)

发表评论

欢迎 访客 发表评论

一个令你着迷的主题!

查看演示 官网购买