Issue installing angular 5


(Komkumar) #1

How to install angular 5 using npm install -g @angular/cli command? I am not aware of the version of angular I should use while running this command?
I tried running the command: npm install -g @angular/cli@5.0.0 , but this is not working. It gives me the error
npm ERR! code ETARGET
npm ERR! notarget No matching version found for @angular/cli@5.0.0
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn’t exist.

I need to install angular 5 (specifically) for my project.
please let me know how do I install angular 5 using the command: npm install -g @angular/cli?


npm ls: listing global packages errors trying to find uninstalled packages
(Lars Willighagen) #2

@angular/cli@5 doesn’t exist, that package only has v1 and v6. The core package is @angular/core, which does have v5.


(Komkumar) #3

So what is the exact command used to install angular 5?


(Lars Willighagen) #4

I think @angular/cli@1 uses angular v5, so:

npm install -g @angular/cli@1

You can then verify the version of angular by running:

npm ls -g @angular/core

(Komkumar) #5
  1. I tried running the command: npm install -g @angular/cli@1
    It ran successfully.
    However, running the command: npm ls -g @angular/core shows the output:
    C:\Users\username> npm ls -g @angular/core

C:\Users\fsdfs\AppData\Roaming\npm

`-- (empty)

I tried running the command : ng -v => output shows angular version as 1.7.4

  1. Next, I tried an alternate command:
    npm install -g @angular/cli@1.5.2 => command runs successfully.
    However, running the command ng -v now, gives an error:

internal/modules/cjs/loader.js:583
** throw err;**
** ^**

Error: Cannot find module '@angular-devkit/core’
** at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)**
** at Function.Module._load (internal/modules/cjs/loader.js:507:25)**
** at Module.require (internal/modules/cjs/loader.js:637:17)**
** at require (internal/modules/cjs/helpers.js:20:18)**
** at Object. (C:\Users\username\AppData\Roaming\npm\node_modules@angular\cli\node_modules@angular-devkit\schematics\src\tree\virtual.js:10:16)**
** at Module._compile (internal/modules/cjs/loader.js:689:30)**
** at Object.Module._extensions…js (internal/modules/cjs/loader.js:700:10)**
** at Module.load (internal/modules/cjs/loader.js:599:32)**
** at tryModuleLoad (internal/modules/cjs/loader.js:538:12)**
** at Function.Module._load (internal/modules/cjs/loader.js:530:3)**

Can you let me know what is wrong?


(Lars Willighagen) #6

I’m pretty sure that ng -v shows an Angular CLI version as 1.7.4 (it does for me), not Angular itself (that field is empty for me, not sure why).

It seems npm ls -g @angular/core wasn’t the right command to verify (it only verifies if @angular/cli isn’t installed globally), but running ng new creates a project with angular v5 on my end, so I think it works anyway.


(Komkumar) #7

Thanks Willighagen. The command npm install -g @angular/cli@1 worked.
I tried creating new project using ng new. It creates a project with angular v5


(system) #8

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.