当前位置:   article > 正文

Ubuntu 上升级nodejs 版本_ubuntu upgrade node

ubuntu upgrade node

代码版本一直升级,需要升级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版本

  1. $ node -v
  2. 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:

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

重启系统可以啦~

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】
推荐阅读
相关标签
  

闽ICP备14008679号