Ubuntu 上升级nodejs 版本

代码版本一直升级,需要升级nodejs的版本

收到的错误信息:

ActionView::Template::Error (Your nodejs binary failed to load autoprefixer script file,
please check if you're running a supported version (10, 12, 14+)

开整,查看我当前的node版本

$ node -v
v8.10.0

删掉旧版本

sudo apt-get remove nodejs

项目里面用到的是node v18, 咱也准备升级到v18, 网上找了一圈,发现在linux上升级用NVM(Node Version Manager)最方便,

按照这个整:

Using Node Version Manager (NVM)

NVM is like a magic wand for managing Node.js versions. Here's how to use it:

  1. Install NVM: Follow the instructions here.
  2. Install Your Desired Version: Run nvm install .
  3. Switch to the New Version: Use nvm use .

Voila! You've updated Node.js.

当我安装V18的时候出现这个错误

because I can't install v18 with this error "node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by node)"

这个是因为我用的ubuntu版本是18,

Node 18+ is incompatible with Ubuntu 18, you can read much more about it here, that's not really something within our control at all.

我只能安装node v16:

$  nvm install 16
v16.20.2 is already installed.
Now using node v16.20.2 (npm v8.19.4)
$ node -v
v16.20.2

重启系统可以啦~

你可能感兴趣的:(ruby,on,rails,开发语言,ruby,ubuntu)