Asked 30+ days ago
3 Nov 2017
Views 176

shabi posted

how to upgarde Node js ?

trying to install react-native-cli by

sudo npm install -g  react-native-cli 

and i got following output

npm WARN engine react-native-cli@2.0.1: wanted: {"node":">=4"} (current: {"node":"0.12.2","npm":"2.7.4"})
/usr/local/bin/react-native -> /usr/local/lib/node_modules/react-native-cli/index.js
react-native-cli@2.0.1 /usr/local/lib/node_modules/react-native-cli
├── semver@5.4.1
├── minimist@1.2.0
├── chalk@1.1.3 (escape-string-regexp@1.0.5, supports-color@2.0.0, ansi-styles@2.2.1, has-ansi@2.0.0, strip-ansi@3.0.1)
└── prompt@0.2.14 (pkginfo@0.4.1, revalidator@0.1.8, read@1.0.7, winston@0.8.3, utile@0.2.1)

it says wanted: {"node":">=4"} (current: {"node":"0.12.2","npm":"2.7.4"}
means it need node version upper than 4.0 and current version is 0.12.2
so how can i upgrade Node js ? using mac system
Mitul Dabhi

Mitul Dabhi
answered Feb 18 '18 20:17

try following command one by one . hope it help to upgrade node js
1. clean cache

sudo npm cache clean -f

it will cache clean , -f means force fully
it will says "npm WARN using --force I sure hope you know what you are doing."


 sudo npm install -g n

-g mean it install globally not locally

sudo n stable

after this it start to download node js and try to install if all goes ok it will install latest version

after installing try node -v it show latest version which 9.0 in your case
Edit Answer

answered Feb 18 '18 20:17

Edit Answer
Post Answer