本文翻译自:Upgrading Node.js to latest version

So, I have Node.js installed and now when I tried to install Mongoosejs I got an error telling me that I don't have the needed version of Node.js (I have v0.4.11 and v0.4.12 is needed). 所以,我已经安装了Node.js,现在当我尝试安装Mongoosejs时,出现一个错误消息,告诉我我没有所需的Node.js版本(我需要v0.4.11和v0.4.12)。

How can I upgrade to this version? 如何升级到此版本? I suppose I just could install it again with the latest version, but I don't want to do it before I'm sure that my project folders in the folder "node" won't be deleted. 我想我可以再次安装最新版本,但是在确定不会删除“节点”文件夹中的项目文件夹之前,我不想这样做。


#1楼

参考:https://stackoom.com/question/gHDy/将Node-js升级到最新版本


#2楼

Linux/Mac: Linux / Mac:

The module n makes version-management easy: 模块n使版本管理变得容易:

sudo npm install n -g

For the latest stable version: 对于最新的稳定版本:

sudo n stable

For the latest version: 对于最新版本:

sudo n latest

Windows: 视窗:

just reinstall node from the .msi in Windows from the node website . 只需从节点网站上的 Windows中的.msi重新安装节点。


#3楼

2019 Solution Without using sudo ! 2019 解决方案不使用sudo

The current stable "LTS" version of node is 12.13.1 ( 2019-11-26 ) see : nodejs.org for latest . 当前稳定的节点“ LTS”版本为12.13.1 ( 2019-11-26 ),有关最新信息, 请参见nodejs.org

Step 1 - Get NVM (Node Version Manger) 第1步- 获取NVM (节点版本管理器)

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bash

If you're curious about the installation command read the source code 如果您对安装命令感到好奇 ,请阅读 源代码
... its been reviewed by several node.js security experts ...它已经由多位 node.js安全专家进行了审查

Step 2 - Install the version of node.js you need 第2步- 安装所需的node.js版本

Once you've got NVM you can install a specific version of Node.js using the nvm command: 获得NVM后 ,可以使用nvm命令安装特定版本的Node.js:

nvm install v12.13.1

Note : you may need to close & re-open your terminal window for nvm command to be available. 注意 :您可能需要关闭并重新打开终端窗口才能使nvm命令可用。

You should expect to see something like this in your terminal: 您应该期望在终端中看到以下内容:

Now using node v12.13.1

Step 3 - Enjoy the rest of your day! 第3步- 享受您余下的一天!

Yes , it's that easy and didn't require sudo ! 是的 ,就是这么简单 ,不需要sudo
Now please Upvote this ( so others can avoid sudo -installing things! ) 现在请对此进行投票这样其他人可以避免sudo -installing !!
and have a lovely day writing node.js code! 愉快地编写node.js代码!

Microsoft Windows User ? Microsoft Windows用户 Use : https://github.com/coreybutler/nvm-windows 使用 : https : //github.com/coreybutler/nvm-windows

tl;dr tl; dr

Review of the node mailing list indicates that using NVM ( Node Version Manager ) is the preferred way to manage your nodejs versioning/upgrading. 查看节点邮件列表表明,使用NVM ( 节点版本管理器 )是管理Node.js版本/升级的首选方法。 see: github.com/nvm-sh/nvm 参见: github.com/nvm-sh/nvm

NVM is considered " better " than N because the verbose commands mean is much easier to keep track of what you are doing in your Terminal/SSH Log. 因为冗长的命令的意思是容易跟踪你在你的终端/ SSH登录在做什么NVM被认为是“ 更好 N多。 Its also faster , saves kittens by not requiring sudo and is used by the team at NPM the node.js security experts ! 它也更快不需要 sudo 可以节省小猫NPM的团队使用node.js 安全专家


#4楼

via npm: 通过npm:

# npm cache clean -f
# npm install -g n
# n stable

and also you can specify a desired version: 并且您还可以指定所需的版本:

# n 0.8.21

reference 参考


#5楼

my 2c: 我的2c:

I tried both with n and with nvm on Linux Ubuntu 12.04 LTS, in order to update node from v0.8.25 to v0.10.22. 为了将节点从v0.8.25更新到v0.10.22,我在Linux Ubuntu 12.04 LTS上同时尝试了n和nvm。

The first one was successfully completed, but the command 'which node' resulted in the old v0.8.25. 第一个成功完成,但是命令“哪个节点”导致了旧的v0.8.25。
The second one was successfully completed and the same command resulted in v.0.10.22. 第二个已成功完成,并且相同的命令产生了v.0.10.22。


#6楼

Upgrading node.js to the latest version on Windows 在Windows上将node.js升级到最新版本

  1. Install chocolatey if you haven't already: Installing Chocolatey 如果尚未安装Chocolatey,请执行以下操作 : 安装Chocolatey

  2. From the command prompt, type 在命令提示符下,键入

    cup nodejs

(which is equivalent to typing choco upgrade nodejs -- assumes you already have node installed) (这相当于键入choco upgrade nodejs -假设您已经安装了节点)

NOTE: You may need to run cinst nodejs.install for chocolatey to register your existing installation. 注意:您可能需要运行cinst nodejs.install以获得Chocolatey来注册现有安装。 (thanks for the comment, @mikecheel) (感谢您的评论,@ mikecheel)


Installing node.js on Windows 在Windows上安装node.js

If you have never installed node, you can use chocolatey to do that as well. 如果您从未安装过节点,那么也可以使用Chocolatey来完成。 Install chocolatey (see step 1 above). 安装巧克力味(请参阅上面的步骤1)。 Then from a command prompt, type: 然后在命令提示符下键入:

cinst nodejs.install

Chocolatey Gallery Node JS (Install) Chocolatey Gallery Node JS(安装)


Installing a specific version of node on Windows with chocolatey 使用Chocolatey在Windows上安装特定版本的节点

cinst nodejs.install -Version 0.10.26

将Node.js升级到最新版本相关推荐

  1. Node.js 更新到最新版本

    文章目录 前言 Linux 系统 使用 NVM 使用 NPM 使用二进制包 Mac系统 安装 更新 Windows系统 其他问题 指定默认版本 npm与node版本不一致 前言 Node.js是一个开 ...

  2. node.js升级和降低版本

     开门见山地说,我们在开发的过程中,随着时间的推移和新框架的层出不穷,我们使用的node.js会因为一直没有更新,导致无法使用最新的一些框架等问题,这个时候我们就需要升级我们的node版本,下文讲详细 ...

  3. npm和node.js升级

    npm是升级命令: npm install npm -g  (直接升级到最新版本) node升级: (1)安装NVM :  curl -o- https://raw.githubusercontent ...

  4. [UE4]把工程升级到最新版本

    右键UE4工程文件,选择"Switch Unreal Engine version..." 确定后,再次双击打开工程升级到最新版本了. 转载于:https://www.cnblog ...

  5. 过去一年25个amazing node.js 开源项目(2018版本)

    2019独角兽企业重金招聘Python工程师标准>>> 过去一年25个令人惊奇的node.js开源项目(2018版本) 过去一年, 我们已经比较了近4,700个Node.js开源项目 ...

  6. Eclipse 版本升级:如何不卸载旧版本 Eclipse 实现在线升级到最新版本?

    文章目录 前言 一.网上没"升级 Eclipse"相关资料吗? 1.1.相关资料很少,我也生气 1.2.升级新版本与在线升级插件傻傻搞不清 二.版本升级准备 2.1.Eclipse ...

  7. 将React Native升级到最新版本的最简单方法

    by Sam Johnson 由山姆·约翰逊(Sam Johnson) 将React Native升级到最新版本的最简单方法 (The easiest way to upgrade React Nat ...

  8. Centos(Linux)升级git最新版本

    在Linux/Centos服务器上,如果使用的git版本过低,使用的时候可能会由于低版本不支持遇到各种问题,比如Centos7系统自带的git版本一般是1.8.3.1的,比较旧,通常建议升级git后再 ...

  9. 2019ug最新版本是多少_宝塔Linux面板7.4.2版本/Windows面板6.8版本请尽快升级到最新版本...

    宝塔Linux面板7.4.2版本/Windows面板6.8版本请尽快升级到7.4.3版本,因为这两个版本目前存在一个漏洞可能会被利用,如果你正好使用这两个版本的话请尽快升级到 Linux面板7.4.3 ...

最新文章

  1. 浙大赵俊博:重新审视模型 vs 数据这个问题!
  2. 转 如何利用客户端缓存对网站进行优化?
  3. 社会主义基本经济规律是经济效益规律
  4. Automatic Judge 模拟
  5. 8-13 刷题 复习 知识点集合
  6. php通过$_SERVER['HTTP_USER_AGENT']获取浏览器useAgent
  7. 百面机器学习—5.SVM要点总结
  8. 区块链 使用xbench测试xuperchain 教程
  9. RN listView使用
  10. H3C防火墙透明模式部署trunk
  11. 毕业后拉开大家差距的原因
  12. 12306刷票工具(简单易学)
  13. QT-使用QT资源文件添加菜单栏、工具栏图标
  14. [转]firefox浏览器油猴脚本-让网页背景成苹果蓝,保护眼睛
  15. c语言关于continue的题,10道c语言基础题1、C语言的跳转语句中,对于break和continue说法正确的是_______. A、contin...
  16. 前端基础 HTML 第九章 使用框架结构 ----暑假学习第五天
  17. 一文了解百度信息流:百度电商直播、百青藤、观星盘
  18. adb 命令之appt
  19. html弹窗中遍历数组,有关js各种数组遍历
  20. 初识ansible和ad-hoc

热门文章

  1. goto VS longjmp setjmp
  2. 奋斗---论门当户对
  3. 解决Android emulator PANIC: Missing emulator engine program for ‘x86‘ CPU.
  4. Android Stadio 导入moudle 不显示
  5. 一文就懂Kotlin作用域函数以及object关键字
  6. Android Studio 新建项目的R文件丢失的解决方法
  7. Android View绘制之旅
  8. (0045) iOS 开发之MBProgressHUD 源码学习
  9. (iOS-基本知识)Category VS Extension 原理详解
  10. Spring和CXF整合发布WebService(服务端、客户端)