Ubuntu 上升级nodejs 版本

发布时间:2024年01月12日

代码版本一直升级,需要升级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 <version>.
  3. Switch to the New Version: Use?nvm use <version>.

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

重启系统可以啦~

文章来源:https://blog.csdn.net/Blue___Ocean/article/details/135556809
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。