nodejs 4.2.6 not getting updated to latest version

354
February 04, 2018, at 06:03 AM

I installed Node and npm as they are required to install angular cli.
Now, if I type this command:

npm install -g angular-cli

I get this message in terminal:

ERROR: npm is known not to run on Node.js v4.2.6 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 also followed this link, but still the issue is not resolved.

I tried removing node, npm and then reinstalling, updating node according to all the ways I found on internet, but still the version(4.2.6) is same.

I don't understand what I am doing wrong as I am new to Linux.

Answer 1

Surprisingly, npm is quite complicated in Linux, until you discover Node Version Manager which allows you to easily install new versions and swap between them.

After installing nvm, you can install any node version with nvm install <VERSION_NUMBER> and you can set it as default with nvm alias default <VERSION_NUMBER>

You can swap between versions using nvm use <VERSION_NUMBER>

Rent Charter Buses Company
READ ALSO
Javascript Search for any file by extantion

Javascript Search for any file by extantion

The following Nodejs program looks for files by specified strings and activated by command "node [jsfile] [

223
How to return Mongoose query results without callback

How to return Mongoose query results without callback

I have an app which is structured: index > routes > endpoints > core, where endpoints process requests to send a response and core accesses the databaseThe point of dividing controllers in to these two components was partially to make things work after a DB change...

381
Beginner Node/React/MySQL -&gt; querying the db and displaying the result

Beginner Node/React/MySQL -> querying the db and displaying the result

I have a React app that is connected to the backend via Express, where I query an SQL database to retrieve dataFinal goal is to display that data via React

219
NodeJS/Express Portfolio routing

NodeJS/Express Portfolio routing

I'm trying to develop a portfolio website in MongoDB, Express and nodeJSThis portfolio website would lead people to my projects, for example "www

218