Yum update or Yum upgrade for nodejs and npm in EC2 server - node.js

I am trying to update/upgrade the nodejs and npm packages using "yum" in the EC2 server (Linux 3.4.48-45.46.amzn1.x86_64 x86_64).
The current version of nodejs is 0.10.36 and i want it to be upgraded to 0.12.0
Below is the command:
sudo yum -y upgrade nodejs
But this does not update/upgrade.
Am I missing something? I also tried updating both nodejs and npm , but no luck.
I also did the following for Linux machines:
sudo npm install n -g and then
sudo n 0.12.2
Any help is appreciated.
Thanks

Related

Can not Install NPM along side with the ROS melodic?

I am using ROS melodic for my current project but I need to install nodejs for my college work in ubuntu 18.04. When I install nodejs by using the following commands
sudo apt install nodejs
sudo apt install npm
it gives me an error like this.
error
So I installed that dependency but after installing that dependency my ros packages removed. How can I install the npm without losing the ROS melodic?
Thanks in advance !!
I found something on the internet that take me to the solution,
I installed python virtual environment
https://linuxize.com/post/how-to-create-python-virtual-environments-on-ubuntu-18-04/
in that virtual environment I installed nodeenv with the help of pip
https://pypi.org/project/nodeenv/#id73
I created node.js virtual environment in which I installed the NPM without getting any error.
And we can also install nodeenv with the global environment too!
I faced the same problem and solutions were deleting whole ros melodic.
found the solution as follows:
$ sudo apt-get purge nodejs npm
after this command if you installed nodejs it's going to be deleted.
enable the NodeSource repository by running the following curl command:
$ curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
then:
$ sudo apt-get install -y nodejs
the nodejs package contains both the node and npm binaries.

Installing latest version of npm on Ubuntu 14.04 (trusty)

I have
a remote serving running Ubuntu 14.04. I used apt to install node
a local OSx machine running El Capitan. I used hombrew to install node.
This results in the following.
Ubuntu 14.04
> sudo apt-get update
> sudo apt-get install node nodejs npm
> npm --version
1.3.10
> node --version
(emtpy)
> nodejs --version
v0.10.25
OSx
> brew install node
> npm --version
5.6.0
> nodejs --version
-bash: nodejs: command not found
> node --version
v8.11.3
Why are the apt repositories so out of date? The npm version on the server (1.3.10) is 4 versions behind that of OSx machin (5.6.0).
This npm issue even mentions that the apt repositories are quite old / not updated.
Is there a way to install a more recent version of npm on the Ubuntu server?
Download this tar file from nodejs official website
https://nodejs.org/dist/v8.11.4/node-v8.11.4.tar.gz
download, untar and install it via using the following command
sudo make test
sudo make install
It will install 8.11.4 version.
Please note that you can download any version of tar from nodejs officail page and can install it on your Ubuntu server and by using this method you don't need to update your apt packages.

Unable to install of latest version of nodejs

I was having nodejs version 4.2.6 in my ubuntu 16.04 pc.
I tried to install n using command sudo npm install -g n, and the following errors came out.
Node.js 4 is supported but the specific version you're running has
a bug known to break npm. Please update to at least 4.7.0 to use this
version of npm. You can find the latest release of Node.js at https://nodejs.org/
I uninstalled the current nodejs and then reinstalled it .But everytime the version 4.2.6 is installed.I am not getting why the latest version is not installed.I followed this link to reinstall my nodejs
enter link description here
Do i need any others updated to have latest nodejs ?Please guide me
Here are the steps to follow:
First clear cache.
Then upgrade npm
Then install stable version if Node
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
If that still didt work
Remove NodeJs and Npm
Install Node
sudo apt remove nodejs npm
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
You can install latest version of nodejs by adding local apt repo as mention in official doc,
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs
and then use n or nvm module to manage version.
Update: You should uninstall older version before installing newer version
sudo apt-get purge nodejs
sudo apt-get autoremove
you can use nvm and install severall version of node and switch on node version
this link help you
enter link description here
use NVM to manage all node versions

How to install nodejs 6.7.0 on Ubuntu 14

I have found some guides (for ex. Install latest nodejs version in ubuntu 14.04) how to install updated version of NodeJS, also followed the official one that says to use
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
which is the same thing as in the SO guide above.
However, the version of node I get is 6.3.1 but I want the latest 6.7.0. I have installed 6.7.0 on OSX via brew but don't know how to get it on Ubuntu. Is there any way to do it, using APT preferably?
I have done this way:-
sudo npm install n -g
sudo n 6.7.0
Alternatively for latest stable version you can do this:-
sudo n stable
And For latest version
sudo n latest

How to install nodejs 0.12.7

I've trying to install the latest version of nodejs
sudo apt-get nodejs
installs the version 0.12.25
When I downloaded the tar.gz from https://nodejs.org/ and installed
my node version upgraded to 0.12.7 but not nodejs version.
And when I tried like this
sudo apt-get install nodejs=0.12.7
E: Version '0.12.7' for 'nodejs' was not found
This error popped up. What can I do such that on entering
nodejs -v
I can get 0.12.7
Since there are a lot of Node.js versions, and there is also iojs, I suggest you to use a straightforward Node.js version manager, like the very good n.
So, first install n, then install Node.js 0.12.7 with:
$ n 0.12.7
When you install node.js from source by default it will install with node as name of the executable
node -v
Will show 0.12.7
If you need node.js for development purposes on your machine you can use nvm, it allows to install different versions of node.js and io.js, and easily switch between them
Remove node with command sudo apt-get remove node, then remove nodejs using sudo apt-get remove nodejs. After that try to install nodejs again with version you need sudo apt-get install nodejs=0.12.7.

Resources