【问题标题】:Nodejs - how to uninstall older version of nodejs and install new version of nodejs in ubuntuNodejs - 如何在 ubuntu 中卸载旧版本的 nodejs 并安装新版本的 nodejs
【发布时间】:2019-11-08 04:17:45
【问题描述】:

我的 react 项目需要更新 nodejs。 那么我如何在 Ubuntu 16.04 中将我的节点 js 重新安装到最新版本。

我当前的节点版本是

node -v
v6.0.0

我当前的 npm 版本是

npm -v
3.8.6

理想情况下,我想将我的 nodejs、node 和 npm 重新安装到其最新版本。

【问题讨论】:

标签: node.js ubuntu


【解决方案1】:

从 Ubuntu 卸载 NodeJS

该命令将删除软件包但保留配置文件。

sudo apt-get remove nodejs
sudo apt-get autoremove

要删除软件包和配置文件,请运行:

sudo apt-get purge nodejs
sudo apt-get autoremove

在 Ubuntu 上安装 NodeJS

将 NodeJS PPA 添加到 Ubuntu

sudo apt-get install software-properties-common
curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -

成功添加 NodeJS PPA 后,现在可以使用以下命令安装 NodeJS。

sudo apt-get install nodejs

验证 NodeJS 和 NPM 的版本

node -v
npm -v

更多信息:http://www.rscoder.com/2020/04/how-do-i-completely-uninstall-nodejs.html

【讨论】:

  • 卸载后,重启系统,然后检查节点版本,如果显示有问题,请按照安装步骤:)
【解决方案2】:

按照以下链接在ubuntu中安装和使用其他版本的nodeJs

https://stackoverflow.com/a/59392965/9490901

【讨论】:

    【解决方案3】:

    从 Ubuntu 卸载 NodeJS

    • sudo apt-get remove nodejs
    • sudo apt-get update

    按照以下链接在 ubuntu 中安装最新的 nodeJs

    https://tecadmin.net/install-latest-nodejs-npm-on-ubuntu/

    你安装成功的,然后如果你想检查节点版本使用下面的命令。

    node -v

    【讨论】:

      【解决方案4】:

      你试过了吗?

      sudo npm cache clean -f
      sudo npm install -g n
      sudo n 10.16.0
      

      n latest 安装最新版本的节点。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-02-25
        • 2021-05-24
        • 1970-01-01
        • 1970-01-01
        • 2014-06-03
        • 1970-01-01
        • 2017-01-07
        • 1970-01-01
        相关资源
        最近更新 更多