WSL nodejs错误:node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by node)

技术运维Ubuntu 1147

在Windows WSL Ubuntu中node出现错误

node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by node)

这时需要用nvm来完成nodejsnpm的重新安装

$ sudo apt-get remove nodejs
$ sudo apt-get remove npm

$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
$ chmod +x ~/.nvm/nvm.sh
$ source ~/.bashrc 

$ nvm -v
0.39.2

$ nvm install 14

$ node -v
v14.20.1
$ npm -v
6.14.17

$ nvm install 16

$ node -v
v16.18.0
$ npm -v
8.19.2

$ nvm install 17

$ node -v
v17.9.1
$ npm -v
8.11.0

也可直接使用下面的方法安装

nvm install --lts
nvm alias default 16.15.1 # Which ever is the latest version being used in the project

Post Comment