node.js - Nodejs - 如何在 ubuntu 中卸载旧版本的 nodejs 和安装新版本的 nodejs

标签 node.js ubuntu

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

我当前的 Node 版本是

node -v
v6.0.0

我当前的 npm 版本是

npm -v
3.8.6

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

最佳答案

从 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

关于node.js - Nodejs - 如何在 ubuntu 中卸载旧版本的 nodejs 和安装新版本的 nodejs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56769070/

相关文章:

django - 在 ubuntu 和 Django 上使用 nginx 的错误请求(400)

python - 通过 SSH 运行 python 进程,即使在关闭 SSH 连接并重新连接后也能监控进程

JavaScripteach() 不工作

javascript - Node.js 中的 SocketCAN

linux - 向 Ubuntu 面板添加一个不断变化的图标

ubuntu - 如何使用 apt 在 Ubuntu 18 上将仪表安装为软件包?

在 ubuntu 12.04 上更改临时目录后,Mysql 无法启动

javascript - 如何在没有 Node.js/NPM 的情况下将我的 Web 应用程序转换为 Angular 4

node.js - 云函数: TypeError: Cannot read property 'auth' of undefined

node.js - 如何在express/mongoose应用程序中正确构建数据库调用?