Why install node js version 8.xx but still show version v6.3.1? - node.js

My server is centos 7
I was install node js 8.x with this command line
curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -
and
sudo yum -y install nodejs
When finished i will check version by node -v but still show v6.3.1
How can i do ?

I would recommend you to use NVM (Node Version Manager) to manage your node versions. It's very useful and it's a great tool to manage your node versions.
To install NVM, run this script on your console:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
Then, to download the latest release of node the following two commands:
nvm install node
nvm use node
If you want to install a specific version of node, you can simply run:
nvm install v8.9.0
nvm use v8.9.0
I hope this helped, if you're still having trouble please let me know.

Related

Install Node on M1 Mac

Kind of a noob here on questions about binaries, processors and how that all works together:
I have a new Mac with an M1 chip, and want to install Node. I'm used to do this with Homebrew. Now, if I install Homebrew, I'm strongly recommended to use Rosetta, so I did. Next step: installing Node. So instead of brew install node I do arch -x86_64 brew install node.
This works fine, only I'm wondering, am I now using node in a sub-optimal way? Is Node also using Rosetta, instead of directly running on the M1 chip?
Depending on your project dependencies, you might find it necessary to run node on an x86 architecture as it may get you past frustrating errors on older versions of node. If like me you had already installed node in your attempts here, you can use the following to help get you sorted (assuming you have already installed NVM):
$ nvm uninstall 14
$ arch -x86_64 zsh
$ nvm install 14
$ nvm alias default 14
Consider replacing 14 above with whichever node version you are attempting to run under.
After installing, you can run node followed process.arch to confirm that node is running in x64 mode:
$ node
> process.arch
'x64'
I just got my M1 Mac mini. I did add an alias since I use oh-my-zsh to my ~/.zshrc for alias brew=arch -x86_64 brew so I don't have to keep typing all that. I brew install nvm then nvm ls-remote and installed v15.5.0. It gets built DV8_TARGET_ARCH_ARM64.
Hope that helps. I also pulled the insiders VSCode for ARM64. Loads in a second.
> node -p "process.arch"
arm64
Don't forget you need xcode-select --install command line tools (~450MB).
From node v16.x:
https://doesitarm.com/app/nodejs/
PS: node v16 has problems with serverless-offline. I managed to solve it using node v15.4.0
From node v15.x:
sudo xcode-select --install
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
nvm install v15
node --version
As Node v16 natively supports Apple Silicon, brew install node or nvm install 16 would work on the Apple M1 laptops.
Here is my current build.
$ nvm --version
0.39.0
$ node --version
v16.13.1
$ node -p "process.arch"
arm64
To install Node 15.6.0 or higher:
Install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
Install NodeJS
nvm install v15
To verify if both nvm and NodeJS were installed successfully, run:
node -v
npm -v
You can find more information here
Nvm install 14.15.3 (current LTS) wasn't successful for me in any of the attempts (with brew arch -x86_64 prefix as well). But, I was able to:
install nvm from github (with putting the "export" string to ~/.zhrc and executing it)
nvm install 15
Note: This VSCode version works for me as well: https://code.visualstudio.com/docs/?dv=osx&build=insiders
Open Terminal Using Rosseta 2 if you haven't installed rosseta2 yet
Just Check out my blog to set up it
https://siddhantjohari.medium.com/setting-up-react-native-in-mac-m1-aaf18c37fc34
Install Homebrew using this command.
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Now hit this command to install nodejs or anything you want
arch -x86_64 brew install <package>
Thank you.
you can install node using n, please follow the link.
n --arch arm64 16

Node JS - Not able to install node js version 8.9 or greater in ubuntu 16.04

I have tried various methods by which I can install the latest version of nodejs on my operating system but was unsuccessful.
In the end it always ends up installing
version v.4.2.6
When I run the commands below, it always shows an error as shared in the screenshots of my terminal.
Current release:
sudo apt-get install curl python-software-properties
curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -
or LTS release:
sudo apt-get install curl python-software-properties
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
// throws error
Version:
Trying to execute node 11 script:
o/p of the above script:
Please guide me how can it be fixed. I have followed some of the other stackoverflow links but couldn't make it.
Thanks you for your help.
I recommand uninstalling your current NodeJS version and install nvm instead.
Then you can manage all node version with nvm.
Method 1:
I followed this link and it was successful:
updating nodejs on ubuntu 16.04
Method 2:
You can either skip above link and follow the below steps:
Using Node Version Manager (NVM):
Install it by following instructions here
Test your installation:
close your current terminal, open a new terminal, and run:
command -v nvm
Use it to install as many versions as u like:
nvm install 8 # Install nodejs 8
nvm install --lts # Install latest LTS (Long Term Support) version
List installed versions:
nvm ls
Use a specific version:
nvm use 8 # Use this version on this shell
Set defaults:
nvm alias default 8 # Default to nodejs 8 on this shell
nvm alias default node # always use latest available as default nodejs for all shells
If you have npm installed -
run
sudo npm cache clean -f
sudo npm install -g n
install n globally
npm i -g n
then switch to the latest stable node version using n
n stable

Installing Nodejs v8.2.1 in ubuntu 17.04

How to install Nodejs v8.2.1 in Ubuntu 17.04. When I give the command 'sudo app install nodejs' the version that gets installed is v4.7.2. - Thanks
There is a good article from NodeJS itself (found by searching for "install node js ubuntu"). You can find it here
You just need to execute the following commands to get the newest NodeJS version.
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
I would also suggest installing nvm so you could run multiple NodeJS versions side by side.
Using the Node Version Manager NVM
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
$ nvm install node
$ node -v

Please update your Node runtime to version >=0.12.x

Hi i'm working with ionic to build hybrid html app.
Every command i'm running i get the following warning:
******************************************************
Upgrade warning - for the CLI to run correctly,
it is highly suggested to upgrade the following:
Please update your Node runtime to version >=0.12.x
******************************************************
If you can please advise how should i update the node runtime version
This is just asking to upgrade your Node. I normally use nvm with command nvm install <version> && nvm use <version> or you can use node helper as follows:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable // for stable version
sudo n 0.12.7 // for specific version like v0.12.7
// check the node version after install
node -v
To install Node.js v5.x on either Ubuntu or Debian:
# Using Ubuntu
curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
sudo apt-get install -y nodejs
# Using Debian, as root
curl -sL https://deb.nodesource.com/setup_5.x | bash -
apt-get install -y nodejs
It depends on how you have installed node.js to your computer. You can either go to https://nodejs.org/ and get the updated version, or you can use Node Version Manager (NVM) which allows you to control multiple node versions at once.
I would recommend using NVM, as this avoids having to install nodejs with sudo, which can lead to other problems down the line.
I use command:
sudo npm cache clean
sudo npm install -g cordova
sudo npm install -g ionic
and it works for me.

Installing nvm on Ubuntu 14.04

I'm trying to install nvm on Ubuntu 14.04 but it doesn't seem to use the version I specify. I installed following the tutorial here https://github.com/creationix/nvm and I've also tried the one here https://www.digitalocean.com/community/tutorials/how-to-install-node-js-with-nvm-node-version-manager-on-a-vps.
There are 2 node installations on my system already.
which node # => /usr/local/bin/node
node --version # => v0.11.13-pre
which nodejs # => /usr/bin/nodejs
nodejs --version # => v0.10.26
When I install nvm using the curl one liner they give you, and then use
nvm install 0.10.32
It creates an empty folder inside .nvm/v0.10.32 and .nvm/current symlinks to it.
In addition the bin folder is also empty. This problem occurs if I install other
versions of node. I suppose I could just clone a version of node into the folder
its supposed to go in but idk if that's all I have to do. In addition, I'm not sure
I know how to make my system use the nvm current (symlink from /usr/local/bin/node to .nvm/current ?) Without doing anything myself and only following the tutorial, node --version and nodejs --version never uses the version I specify with.
nvm use 0.10.32
Here is my personal guide how to install nvm (node version manager).
reference: https://github.com/creationix/nvm
1.) Install nvm (NOTE: There might be new versions in their website.)
curl https://raw.githubusercontent.com/creationix/nvm/v0.24.0/install.sh | bash
2.) Close the current terminal and use a new terminal then try nvm again.
3.) Install current node.js version by using:
nvm install node_version
ex: nvm install 0.10.32
4.) to check the nodejs version--> nvm list
5.) Setup a default node version in nvm so that everytime you restart
the system it loads a default node version:
to get help: nvm -h
to get list of install node.js versions: nvm ls
to set a default alias: nvm alias default node_version
6.) Uninstall a specific node.js version:
nvm uninstall node_version
I understand that my answer may be outdated, but there was a very nice thesis in the ticket #809, that using
$ npm install -g nvm
is wrong. To fix, you want to do
$ npm uninstall -g nvm
$ apt install curl
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash
$ source ~/.bashrc
$ nvm install 5.1
$ nvm use 5.1
instead (given that curl hasn't yet been installed on that machine).
I just removed all of the offending node installations until my system used a version that was 0.10.* . It appears I tried to install node before or another program installed it.

Resources