How to get my system to use node version installed by Homebrew? - node.js

On OS X, when I run node --version I get v12.9.1. I ran brew upgrade node and it warned me Warning: node 15.3.0 already installed. I ran brew uninstall node, but then when I ran node --version I still got v12.9.1.
**What I Want To Know: **
Why does my system say that my node version is 12.9.1 when 15.30.0 is installed? How can I get it so that my system is using 15.3.0 instead of 12.9.1?

Related

npm is not compatible with Node.js

I had node installed in my machine and everything was working fine. During an online course made in 2019, the instructor was using an earlier version of npm (v5.5.1) and advised everyone to use the same version with him for follow up reasons. So I downgraded to v5.5.1 but now I keep getting one same error (incompatibility) for almost all commands. I read some solutions to similar problems here and even tried extra steps but the problem still persists.
I uninstalled node from my system, restarted the system and reinstalled node but the version of npm still remained v5.5.1.
I tried to uninstall npm from the command line npm uninstall -g npm but it threw incompatibility error.
I searched the web for compatible version of node.js for npm v5.5.1 and got node v10.15.1 which I downloaded installed with several system restarts but my node and npm still remain incompatible. Please what can I do?
You should use nvm which is the Node Version Manager, cURL:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
commands:
nvm install <version> Download and install a <version>
nvm use <version> Modify PATH to use <version>
nvm ls List versions (installed versions are blue)
Helpful reads:
How can the default node version be set using NVM?
How to change node version with nvm

Used brew to install node, when checking node version, says not installed

I have tried uninstalling node with brew and reinstalling. I get a link error and when I check what version of node I have installed with node -v, it says node is not installed. What could be going on?

Updating Node and NPM

On a Mac OSX, I want to update to the latest versions of node and npm which is currently v10.7.0
I installed homebrew and executed the following at the terminal.
brew update
brew upgrade node
Now, when I type
node -v
the terminal responds:
v6.10.2
And when I type
npm -v
the terminal responds:
6.2.0
It looks like I have earlier versions of Node.
But when I type
brew upgrade node
The terminal responds with
node 10.7.0 already installed
It looks like there's a discrepancy. On one hand, it's telling me I have an earlier version of node. On the other hand, it's telling me I have the latest version.
What can I do to install and get my machine to recognize the latest node version?
You probably need to link the new version using brew link node or brew link --overwrite node
I have been using nvm on my linux servers for a while and now prefer to use it (over homebrew) on my development mac as well -
curl --silent -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
Now just open a new shell (or source ~/.nvm/nvm.sh) and switch to whichever version you would like. Eg.
nvm install 10.7.0
nvm use 10.7.0

How do I change my Node version after installing it using Homebrew?

After installing Node using Homebrew on OSX 10.11.6 I now have a copy of node installed at
/usr/local/Cellar/node/10.7.0.
However, the version of Node that appears when I run
$ node -v
in terminal is
v0.12.7
I would like OSX terminal to reference the v10.07 of Node I just installed via Homebrew when I type
$ node
How do I change which node version that OSX terminal recognizes?
You should try using NVM. It allows you to install multiple versions of Node on your machine and switch between them conveniently:
see NVM docs

React Native Node install Error

I am trying to install the environment for react native.
I followed the instruction of the site until the point to enter into the cmd
create-react-native-app AwesomeProject
after several moments I get a big green message:
You are currently running Node v0.12.2.
React Native runs on Node 4.0 or newer. There are several ways to
upgrade Node.js depending on your preference.
nvm: nvm install node && nvm alias default node
Homebrew: brew unlink iojs; brew install node
Installer: download the Mac .pkg from https://nodejs.org/
About Node.js: https://nodejs.org
Follow along at: https://github.com/facebook/react-native/issues/2545
I try to upgrade my nodejs but I have the newest version form the site.
why does it still throws me this error ?
Hi user24136 i build react native apps myself and i have latest Node version running. Error states your Node.js installed is old and React Native does run on Node 4.0+. Seems like your on a Mac, visit this link Node.js and use installer to upgrade your NPM and Node to latest versions. After successful installations run commands node -v and npm -v and you should see newer version v6.10.3 and 3.10.10 respectively. Then run command react-native init AwesomeProject and check if it works.
This problem interested in from your only node version
you can use sudo n stable command your terminal. This command increase your node version.

Resources