简体   繁体   English

在Ubuntu上将Node.js从v0.12.7更新到v5.x

[英]Update Nodejs to v5.x from v0.12.7 on Ubuntu

I'm trying to put a MEAN stack app on a DigitalOcean MEAN image droplet. 我正在尝试将MEAN堆栈应用程序放在DigitalOcean MEAN图像滴上。 I followed this step-by-step tutorial on how to login and upload the files via Github. 我跟着一步一步如何登录,并通过Github上上传文件教程。

That's all fine, but one of my app dependencies relies on Node v4 or greater: 很好,但是我的应用程序依赖项之一依赖于Node v4或更高版本:

npm WARN engine mongoose-paginate@5.0.0: wanted: {"node":">=4.0.0"} (current: {"node":"0.12.7","npm":"2.11.3"}

So, what I did was try to update Nodejs to the latest version, which is 5.1.0 using this setup script. 因此,我所做的就是尝试使用安装脚本将Nodejs更新到最新版本,即5.1.0。

To do that, I ran the following commands from Terminal: 为此,我从终端运行了以下命令:

$ curl -sL https://deb.nodesource.com/setup_5.x | bash -
$ apt-get install nodejs

Then, I was given this message: 然后,我收到此消息:

nodejs is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 95 not upgraded.

I know it didn't update because if I run node -v it says v0.12.7 . 我知道它没有更新,因为如果我运行node -v它会显示v0.12.7 I even restarted the droplet, but nothing happens. 我什至重新启动了液滴,但是什么也没发生。

(I did all of this under root user btw) (我是在root用户btw下完成所有操作的)

I tend to use npm install -gn and n 5.4.1 or nvm , when I have any version of node installed. 当我安装了任何版本的节点时,我倾向于使用npm install -gnn 5.4.1nvm

On Ubuntu, if I don't have anything installed, I find it easiest to compile from source: 在Ubuntu上,如果我没有安装任何东西,我发现从源代码编译最容易:

sudo apt-get install -y build-essential
git clone https://github.com/nodejs/node && cd node
./configure
make -j8 && make install

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM