Simon
Simon

Reputation: 2538

Downgrading node getting error "Invalid version"

I installed n using npm install -g n -f, and now when I run n 9 or n 8 or n 10 I always get the error:

$ n 9

  installing : node-v9.11.2

  Error: invalid version '9.11.2'

I don't understand why. These are valid versions.

When I run node -v I get:

v12.7.0

Any ideas why I might be getting this issue? It's really frustrating.

Upvotes: 2

Views: 390

Answers (1)

mohammad javad ahmadi
mohammad javad ahmadi

Reputation: 2081

You need to install any version of the node you want to use the following command to use the n module

n <version> to install a version of node. Example:

n 4.9.1 or

n 9.11.2 or

n 10 or

n latest or

n v8.11.3

After each installation, you will see a list of all the nodes available in the system with the n command prompt.

Finally, if the version of the node you want is available in the list provided, you can select and execute it with the ‍‍‍$ n 9 command.

Upvotes: 1

Related Questions