node.js 如何降级 Node 版本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/47008159/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 18:33:29  来源:igfitidea点击:

How to downgrade Node version

node.js

提问by Shashika

I want to downgrade my Node version from the latest to v6.10.3.

我想将我的 Node 版本从最新版本降级到v6.10.3.

But nothing worked so far. Tried NVM and it gives an error as well by saying make command is not found. How can I downgrade Node?

但到目前为止没有任何效果。尝试过 NVM,它也给出了一个错误,说没有找到 make 命令。如何降级节点?

回答by aircraft

You can use nfor node's version management. Thereis a simple intro for n.

您可以n用于节点的版本管理。一个简单的介绍n

$ npm install -g n
$ n 6.10.3

this is very easy to use.

这很容易使用。

then you can show your node version:

然后你可以显示你的节点版本:

$ node -v
v6.10.3

回答by Dharmendra Singh Pokhariya

For windows:

对于窗户:

Steps

脚步

  1. Go to Control panel> program and features>Node.jsthen uninstall

  2. Go to website: https://nodejs.org/en/and download the version and install.

  1. Control panel> program and features>Node.js然后卸载

  2. 转到网站:https: //nodejs.org/en/并下载版本并安装.

回答by sertal70

If you are on macOS and are not using NVM, the simplest way is to run the installer that comes from node.js web site. It it clever enough to manage substitution of your current installation with the new one, even if it is an older one. At least this worked for me.

如果您使用的是 macOS 并且不使用 NVM,最简单的方法是运行来自 node.js 网站的安装程序。它足够聪明,可以用新安装替换当前安装,即使它是旧安装。至少这对我有用。

回答by Hariharan AR

 curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
 sudo npm install -g n
 sudo n 10.15
 npm install
 npm audit fix
 npm start

回答by Sasi Kumar M

For windows 10,

对于 Windows 10,

  • Uninstalling the node from the "Add or remove programs"
  • Installing the required version from https://nodejs.org/en/

worked for me.

对我来说有效。

回答by Khaled Lela

Determining your Node version

确定您的节点版本

node -v  // or node --version
npm -v   // npm version or long npm --version

Ensure that you have ninstalled

确保您已n安装

sudo npm install -g n // -g for global installation 

Upgrading to the latest stable version

升级到最新的稳定版本

sudo n stable

Changing to a specific version

更改为特定版本

sudo n 10.16.0

Answer inspired by this article.

本文启发的答案。

回答by Kalana Demel

Try using the following commands

尝试使用以下命令

//For make issues 
sudo apt-get install build-essential

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

//To uninstall a node version 
nvm uninstall <current version>

nvm install 6.10.3

nvm use 6.10.3

//check with 
node -v

回答by itsHarshad

This may be due to version incompatibility between your code and the version you have installed.

这可能是由于您的代码与您安装的版本之间的版本不兼容。

In my case I was using v8.12.0for development (locally) and installed latest version v13.7.0on the server.

就我而言,我使用v8.12.0进行开发(本地)并在服务器上安装了最新版本v13.7.0

So using nvmI switched the node version to v8.12.0 with the below command:

因此,使用nvm我使用以下命令将节点版本切换到 v8.12.0:

> nvm install 8.12.0 // to install the version I wanted

> nvm use 8.12.0  // use the installed version

NOTE:You need to install nvm on your system to use nvm.

注意:您需要在系统上安装 nvm 才能使用 nvm。

You should try this solution beforetrying solutions like installing build-essentialsor uninstalling the current node versionbecause you could switch between versions easily than reverting all the installations/uninstallations that you've done.

尝试安装build-essentials卸载当前节点版本解决方案之前,您应该尝试此解决方案,因为与还原您已完成的所有安装/卸载相比,您可以轻松地在版本之间切换。

回答by Alberto S.

In case of windows, one of the options you have is to uninstall current version of Node. Then, go to the node website and download the desired versionand install this last one instead.

对于windows,您拥有的选项之一是卸载当前版本的 Node.js。然后,转到节点网站并下载所需的版本并安装最后一个。

回答by kayleeFrye_onDeck

If you're on WindowsI suggest manually uninstalling node and installing chocolateyto handle your node installation. chocois a great CLI for provisioning a ton of popular software.

如果您使用的是Windows,我建议您手动卸载节点并安装Chocolatey来处理您的节点安装。choco是用于配置大量流行软件的出色 CLI。

Then you can just do,

那你就可以做,

choco install nodejs --version $VersionNumber

and if you already have it installed via chocolatey you can do,

如果你已经通过巧克力安装了它,你可以这样做,

choco uninstall nodejs 
choco install nodejs --version $VersionNumber

For example,

例如,

choco uninstall nodejs
choco install nodejs --version 12.9.1