'angular-cli ng fails to create new project: Err No matching version found for @angular/cli@~0.0.0
I am new to angular, it was working initially and I created some sample projects, real fun!! Then I tried to clone a project and ran npm install and since I have not been able to run (serve) any previous projects or create new ones.
When creating new projects it throws the following error:
npm ERR! code ETARGET
npm ERR! notarget No matching version found for @angular/cli@~0.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.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of 'hello-world'
npm ERR! notarget
I installed angular using npm install -g @angular/cli@latest
Checked the version ng --version shows
Angular CLI: local (v0.0.0, branch: master)
Node: 12.13.1
OS: win32 x64
Angular:
...
Package Version
------------------------------------------------------
@angular-devkit/architect <error>
@angular-devkit/core <error>
@angular-devkit/schematics <error>
@schematics/angular <error>
@schematics/update <error>
I've tried various suggestion I found
- uninstalling module
- clearing cache (--force) etc
- or updating version as suggested here https://www.npmjs.com/package/@angular/cli#updating-angular-cli
Nothing has worked so far
I must have missed something … as the previous projects show the correct version of angular/cli when I ran ng --version
Angular CLI: local (v0.0.0, branch: master)
Node: 12.13.1
OS: win32 x64
Angular: 8.2.14
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.803.19
@angular-devkit/build-angular 0.803.19
@angular-devkit/build-optimizer 0.803.19
@angular-devkit/build-webpack 0.803.19
@angular-devkit/core 8.3.19
@angular-devkit/schematics 8.3.19
@angular/cdk 8.2.3
@angular/cli 8.3.19
@angular/material 8.2.3
@ngtools/webpack 8.3.19
@schematics/angular 8.3.19
@schematics/update 0.803.19
rxjs 6.4.0
typescript 3.5.3
webpack 4.39.2
Solution 1:[1]
I have Nodejs already installed on my machine. Here are the steps that I followed to attempt to reproduce:
Installed the Angular CLI by running
npm install -g @angular/cli@latestChecked Angular version by running
ng --versionwhich gave me the following:Angular CLI: 8.3.19 Node: 10.15.3Cloned an example Angular project. I used this one: https://github.com/DeborahK/Angular-GettingStarted
In the new directory, I ran the following:
npm install && npm update
And finally, I ran ng serve which successfully initiated my web application and hosted on localhost:4200
I would suggest removing the currently installed Angular package on your machine (global location and local location). Then reinstall Angular and try once more.
Solution 2:[2]
Make sure you don't have the old CLI package installed, run:
npm uninstall -g angular-cli
npm uninstall -g @angular/cli
Then run:
npm install -g @angular/cli
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | s.remp |
| Solution 2 | Damian C |
