0

I have been trying to install Angular CLI on my Windows system.

I am new to this, and have been following steps given in https://angular-templates.io/tutorials/about/learn-angular-from-scratch-step-by-step to setup my environment. Since I am using Windows, I used "nodist" NVM method to install node and npm on my system. I can successfully run both these commands hinting to the fact that perhaps npm and node have been installed correctly -

C:\WINDOWS\system32>npm -v
1.2.24
C:\WINDOWS\system32>node -v
v0.10.9

Now, to install Angular CLI, I ran -

C:\WINDOWS\system32>npm install -g @angular/cli
npm ERR! addLocal Could not install angular/cli
npm ERR! Error: ENOENT, stat 'C:\WINDOWS\system32\angular\cli'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "@angular/cli"
npm ERR! cwd C:\WINDOWS\system32
npm ERR! node -v v0.10.9
npm ERR! npm -v 1.2.24
npm ERR! path C:\WINDOWS\system32\angular\cli
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\WINDOWS\system32\npm-debug.log
npm ERR! not ok code 0

I tried creating a folder 'C:\WINDOWS\system32\angular\cli'. Also, tried cleaning cache and retrying. But none of it helped.

Edit :

Okay I tried setting up through the installer file mentioned in one of the comments, and now I have node version - "10.16.3" and npm version - "6.9.0". But running the mentioned command for installing angular-cli gives me this error :

C:\WINDOWS\system32>npm i -g @angular/cli
npm ERR! code ECONNREFUSED
npm ERR! errno ECONNREFUSED
npm ERR! FetchError: request to http://registry.npmjs.org/@angular%2fcli failed, reason: connect ECONNREFUSED 104.16.18.35:80
npm ERR!     at ClientRequest.req.on.err (C:\Users\comviva\AppData\Roaming\nvm\v0.10.9\node_modules\npm\node_modules\node-fetch-npm\src\index.js:68:14)
npm ERR!     at ClientRequest.emit (events.js:198:13)
npm ERR!     at Socket.socketErrorListener (_http_client.js:392:9)
npm ERR!     at Socket.emit (events.js:198:13)
npm ERR!     at emitErrorNT (internal/streams/destroy.js:91:8)
npm ERR!     at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
npm ERR!     at process._tickCallback (internal/process/next_tick.js:63:19)

Also, I am using a system at my office. And looking up the proxy settings at "Change Proxy Settings" on Windows, I don't see any Proxy server being used.

  • upgrade your node and npm versions – dasunse Oct 16 '19 at 08:14
  • npm install -g npm@latest – Rebai Ahmed Oct 16 '19 at 08:57
  • @AhmedRebai Getting this error when I run this command : npm ERR! Error: connect ECONNREFUSED npm ERR! at errnoException (net.js:884:11) npm ERR! at Object.afterConnect [as oncomplete] (net.js:875:19) npm ERR! { [Error: connect ECONNREFUSED] npm ERR! code: 'ECONNREFUSED', npm ERR! errno: 'ECONNREFUSED', npm ERR! syscall: 'connect' } – Ariba Siddiqui Oct 16 '19 at 11:39

1 Answers1

0

It looks like you have the wrong node version or the overall installation file. You can get the working version of node here https://nodejs.org/en/ and choose the recommended version for most users. go through the installation process and after that just run npm i -g @angular/cli.

  • This page https://docs.npmjs.com/downloading-and-installing-node-js-and-npm says : "We strongly recommend using a Node version manager to install Node.js and npm. We do not recommend using a Node installer, since the Node installation process installs npm in a directory with local permissions and can cause permissions errors when you run npm packages globally." And hence, I wanted to use NVM instead to install node. Should I not? – Ariba Siddiqui Oct 16 '19 at 11:36
  • @Ariba Siddiqui That is only if you ever gonna need different versions of node. I never needed nvm through whole time I worked with angular. but if you read it further down there is specific nvm package for windows which is the one you should use. – Nerijus Pamedytis Oct 16 '19 at 12:00
  • @AribaSiddiqui Yeah, you need to talk to your system administrator, it can be that they have set up something to prevent such connections. Sadly this is outside of my expertise... – Nerijus Pamedytis Oct 16 '19 at 13:00
  • 1
    Thanks, I talked to the system admin and it was the proxy server setting I had to change. – Ariba Siddiqui Oct 17 '19 at 09:50
  • @NerijusPamedytis i suggest using [nodist](https://github.com/nullivex/nodist) instead of nvm on windows, the nvm win porting is in a pretty rude state yet. – netalex Feb 13 '20 at 13:54