所以,我已经安装了Node.js,现在当我试图安装Mongoosejs时,我得到了一个错误,告诉我我没有所需的Node.js版本(我有v0.4.11和v0.4.12是需要的)。
如何升级到这个版本?我想我只是可以用最新版本重新安装它,但我不想在确定文件夹“node”中的项目文件夹不会被删除之前这样做。
所以,我已经安装了Node.js,现在当我试图安装Mongoosejs时,我得到了一个错误,告诉我我没有所需的Node.js版本(我有v0.4.11和v0.4.12是需要的)。
如何升级到这个版本?我想我只是可以用最新版本重新安装它,但我不想在确定文件夹“node”中的项目文件夹不会被删除之前这样做。
当前回答
我正在Ubuntu中为angular安装node。我也有点纠结。以下是节省你时间的解决方案。
运行以下命令
curl - ssl https://deb.nodesource.com/setup_16.x | sudo - e bash -
然后运行下面的代码
Sudo apt-get install -y nodejs
它应该工作,但如果仍然没有工作到你让我知道。
其他回答
我正在Ubuntu中为angular安装node。我也有点纠结。以下是节省你时间的解决方案。
运行以下命令
curl - ssl https://deb.nodesource.com/setup_16.x | sudo - e bash -
然后运行下面的代码
Sudo apt-get install -y nodejs
它应该工作,但如果仍然没有工作到你让我知道。
在Mac OSX上使用brew和nvm:
如果你不使用nvm,首先卸载nodejs。然后安装Homebrew(如果还没有安装)。然后安装nvm和node:
brew install nvm
nvm ls-remote # find the version you want
nvm install v7.10.0
nvm alias default v7.10.0 # set default node version on a shell
现在,您可以在需要时轻松切换节点版本。
额外的好处:如果你在使用nvm时看到“tar: invalid option”错误,brew install gnu-tar并按照brew给你的说明来设置你的PATH。
Windows 10
在C:\Program Files\nodejs\ node_modules文件夹中打开CMD,输入npm i npm
我在Ubuntu中的节点版本是v7.10.0
使用以下命令升级
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
现在已经升级到v8.2.1
or
sudo apt-get install make
sudo curl -L https://git.io/n-install | bash
. /home/$USER/.bashrc
# Below command should get the latest version of node
node --version
# Install specific version of node
n 8.2
# Check for the Node Version installed
node --version
使用nvm安装node js即可。它会下载node js的最新版本。
执行命令curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
执行命令后。关闭终端并重新打开,然后运行此命令安装node js的最新版本。
执行命令NVM install v14.15.5
现在输入node -v进行检查