I'm trying to upgrade Node to v6.11.0 using the following instructions: https://www.abeautifulsite.net/how-to-upgrade-or-downgrade-nodejs-using-npm
I've used:
sudo npm cache clean -f
sudo npm install -g n
sudo n 6.11.0
which resulted in:
install : node-v6.11.0
mkdir : /usr/local/n/versions/node/6.11.0
fetch : https://nodejs.org/dist/v6.11.0/node-v6.11.0-darwin-x64.tar.gz
######################################################################## 100.0%
installed : v0.10.40
It looks like I can't install a version of node greater than v0.10.40. The main reason why I'm trying to upgrade is that I'm receiving a error ('SyntaxError: Use of const in strict mode.') as seen here: https://github.com/Shopify/slate/issues/317
Related
I want to upgrade node to 12.10.0 and npm to 6.11.3, currently I am working on macOS Mojave version 10.14.5
I am using these commands to upgrade the node version to 12.10.0::
sudo npm cache clean -f (force) clear you npm cache
sudo npm install -g n install n (this might take a while)
sudo n 12.10.0 upgrade to the specific version
After running the last command it gives me an output like::
installing : node-v12.10.0
mkdir : /usr/local/n/versions/node/12.10.0
fetch : https://nodejs.org/dist/v12.10.0/node-v12.10.0-darwin-x64.tar.gz
installed : v12.10.0 to /usr/local/bin/node
active : v10.16.3 at /usr/local/opt/node#10/bin/node
When I am checking for node version node -v it still shows me old version 10.16.3
I have tried to add node path, but still, it gives me the same output.
I have used command sudo nano /etc/path and then added /usr/local/bin/node path to it.
Please suggest me how can I upgrade node to 12.10.0 and npm to 6.11.3 version?
Install nvm following below tutorial :
Install nvm with homebrew
As stated in the link above,
Start by :
brew update
brew install nvm
mkdir ~/.nvm
nano ~/.bash_profile
In your .bash_profile file (you may be using an other file, according to your shell), add the following :
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
Back to your shell, activate nvm and check it (if you have other shells opened and you want to keep them, do the same) :
source ~/.bash_profile
echo $NVM_DIR
Then with the help nvm install any node version(example v12.14.1) you want :
nvm install v12.14.1
nvm use v12.14.1
to switch to 12.14.1 version.
Step 1: Clean npm cache
sudo npm cache clean -f
Step 2: Install node helper (n) globally using the following command.
sudo npm install -g n
Once node helper is installed. You can either get a specific version like I needed 16.14.1 then you can perform.
sudo n 16.14.1
OR You can get the latest stable version using
sudo n stable
Then you can confirm the version installed
node --version
install n (npm module) npm install -g n and run sudo n latest or sudo n <version>
An alternate way to upgrade w/o using brew -
Go to nodejs releases page. The table on this page list the various node release available for download.
Click on the downloads link for the version you need. This will take us to another page to download the node version depending on the OS you are using. For mac, we can download the .pkg format.
After the package is downloaded, we can run it by clicking the downloaded file and hitting 'Next' till we complete.
I want to upgrade node to the latest stable version ( 6.9.5 ) but it doesn't work:
# node -v
v0.10.37
# sudo npm cache clean -f
npm WARN using --force I sure hope you know what you are doing.
# sudo npm install -g n
/usr/local/bin/n -> /usr/local/lib/node_modules/n/bin/n
/usr/local/lib
└── n#2.1.4
# sudo n 6.9.5
install : node-v6.9.5
mkdir : /usr/local/n/versions/node/6.9.5
fetch : https://nodejs.org/dist/v6.9.5/node-v6.9.5-linux-x64.tar.gz
######################################################################## 100,0%
installed : v6.9.5
# node -v
v0.10.37
You need to specify to use the version of node you just installed
n use 6.9.5 script.js
You can list node versions installed with n using
n
If you want to set your default node version you will need to change the path to your node binary, get it by executing:
n bin 6.9.5
In Linux, MacOS and BSD, in your .bashrc/.zshrc you should modify line:
export PATH=$PATH:/usr/local/nodejs/bin
to refer to the path you got earlier.
On Windows set it similarly in the PATH variable in your system environment variables.
Referencing docs.
I have installed node and npm using following command in my Ubuntu machine:
sudo apt-get install nodejs npm
On checking version of installed, I could see following:
$ node -v && npm -v
v0.10.25
1.3.10
But I want nodejs version to be 4.2.0 or above. I am trying to install VSO Linux agent for a project. On executing node agent/vsoagent, I get error that node version should be 4.2.0 or above.
How do I install it and also make sure that the already installed ones are removed with node -v && npm -v gives me new version number?
Thanks
You already have npm, so you can use n manager to install any version you want (4.4.4 for ex): maybe you should use sudo for global install:
npm install -g n
n 4.4.4
Or
n latest
After that you can just run n to select version that you prefer. I use latest LTS and latest 6.x side-by-side and switching them anytime i want.
I am using ubuntu 15.10
ionic version 1.7.15.
I was trying to update my nodejs to laters version 6 and npm and after that when i run ionic server command i am getting error shown in
the command i used to update
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
how to to downgrade my nodejs
when i use whereis node command
node: /usr/local/bin/node /opt/node/bin/node
when i use whereis nodejs command
nodejs:
when i use whereis npm command
npm: /usr/local/bin/npm /opt/node/bin/npm
I think i have to use lower version of node but i dont know how to do is i have tried my cmd but no use
I solved this issue by mention the version of node
sudo npm cache clean -f
sudo npm install -g n
sudo n v4.2.3 //By mentioning the version while i install i solved this error on serve
i switched my node version from v6 to v4 so then i got no error
I have trouble upgrading Node.js.
Currently, I have node --version "v0.8.18" and I would like to upgrade to the latest "v0.10.20". So I followed some answers that does not include NVM, since I want to know how to do it from scratch. However, after trying, I still get node --version "v0.8.18".
I am on an Ubuntu 11.04 machine, on my home directory.
Specifically I did:
Try 1:
alice#simba:~$ node --version
v0.8.18
alice#simba:~$ sudo n stable
sudo: n: command not found
alice#simba:~$ sudo npm install n -g
npm http GET https://registry.npmjs.org/n
npm http 200 https://registry.npmjs.org/n
npm http GET https://registry.npmjs.org/n/-/n-1.1.0.tgz
npm http 200 https://registry.npmjs.org/n/-/n-1.1.0.tgz
/usr/bin/n -> /usr/lib/node_modules/n/bin/n
n#1.1.0 /usr/lib/node_modules/n
alice#simba:~$ sudo n stable
install : 0.10.20
mkdir : /usr/local/n/versions/0.10.20
fetch : http://nodejs.org/dist/v0.10.20/node-v0.10.20-linux-x64.tar.gz
...
...#############/usr/bin/node
installed : v0.10.20
alice#simba:~$ node --version
v0.8.18
Try again:
alice#simba:~$ npm cache clean -f
alice#simba:~$ sudo npm install n -g
/usr/local/bin/n -> /usr/local/lib/node_modules/n/bin/n
n#1.1.0 /usr/local/lib/node_modules/n
alice#simba:~$ n stable
/usr/local/bin/node
alice#simba:~$ sudo n stable
/usr/local/bin/node
alice#simba:~$ node --version
v0.8.18
I use nvm myself, but something I've bumped up against in the past is that installing a version and selecting a version as active are different operations.
It may be that your new version is installed but not currently the default. Try:
n use 0.10.20