简体   繁体   中英

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. I followed this step-by-step tutorial on how to login and upload the files via Github.

That's all fine, but one of my app dependencies relies on Node v4 or greater:

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.

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 . I even restarted the droplet, but nothing happens.

(I did all of this under root user btw)

I tend to use npm install -gn and n 5.4.1 or nvm , when I have any version of node installed.

On Ubuntu, if I don't have anything installed, I find it easiest to compile from source:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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