8

I am trying to install angular 5 in my pc. Everything installed correctly,but when I use 'ng-serve' command to run my application it shows following error.

You are running version v8.7.0 of Node.js, which is not supported by Angular CLI v6.
The official Node.js version that is supported is 8.9 and greater.

Please visit https://nodejs.org/en/ to find instructions on how to update Node.js.

current version of node.js is '8.7.0' and npm is '6.0.0'.

After a lot of search I followed below steps to update my node.js on windows 10

npm cache clean -f
npm install -g n
n latest

but I failed to use this commands,it shows following error

C:\WINDOWS\system32>npm cache clean -f
npm WARN using --force I sure hope you know what you are doing.

C:\WINDOWS\system32>npm install -g n
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for n@2.1.8: wanted {"os":"!win32","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! notsup Valid OS:    !win32
npm ERR! notsup Valid Arch:  any
npm ERR! notsup Actual OS:   win32
npm ERR! notsup Actual Arch: x64

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\HP\AppData\Roaming\npm-cache\_logs\2018-05-06T07_36_10_847Z-debug.log

how can I update node.js to latest version inorder to run my angular5 application?

Pranab V V
  • 1,386
  • 5
  • 27
  • 53

5 Answers5

9

You have the message indicating that the installed node version does not support Angular. What you need to do is update your node. The commands you are using, are not for updating on WINDOWS, are commands to use on Linux and MacOs You should use this command:

npm install npm@latest -g
Rhay
  • 121
  • 1
  • 4
6

Problem here is you are already having node version of 8.7.0 installed in your machine.You have to remove that first.

Steps to solve this issue.

1.Check path of nodejs in environment variables

2.Go to that path and delete the entire folder(old node js)

3.Delete that path in environmental variables

4.Go to some path and type npm in cmd.you should get command not recognized.

4.Now go to the desired path and run npm install command.your new version of node js will be updated.

Hope I helped

Bhavya
  • 61
  • 1
1

I had this issue too but I think it was my mistake, possibly installed from the wrong directory, corrupted some module or whatnot. I determined my issue by looking at the npm log and reviewing some weird messages about directories missing things that shouldn't have been in the listed directories.

Anyways, I removed "node_modules" in the root working directory, then ran:

npm uninstall npm -g

Browsed to "%userprofile%\AppData\Local" and removed:

npm-cache
node-gyp

And then re-installed/updated npm:

npm install -g npm@latest
jacktrader
  • 588
  • 5
  • 10
0

Reinstalling ng-cli and removing npm & npm-cache from C:\Users***\AppData\Roaming fixed this issue;

More details can be found here: https://stackoverflow.com/a/62184572/6792588

Naor Bar
  • 1,991
  • 20
  • 17
0

You can download Windows Installer and set up as new install https://nodejs.org/en/download/

Giangimgs
  • 952
  • 1
  • 12
  • 16