My versions are
Angular CLI: 9.1.13
Node: 16.16.0
OS: win32 x64
I ran
npm install -g #angular/cli
and
ng --version
commands but I am getting errors in the version of package of angular project
Package Version
------------------------------------------------------#angular-devkit/architect <error>
#angular-devkit/core <error>
#angular-devkit/schematics <error>
#schematics/angular <error>
#schematics/update <error>
I even tried all these commands
npm uninstall -g #angular/cli
npm install -g npm#6.14.12
Related
ng v shows:
Angular CLI: 15.0.5
Node: 16.15.1
Package Manager: npm 9.2.0
OS: win32 x64
Angular: <error>
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
#angular-devkit/architect 0.1500.5 (cli-only)
#angular-devkit/build-angular 15.1.2 (cli-only)
#angular-devkit/core 15.0.5 (cli-only)
#angular-devkit/schematics 15.0.5 (cli-only)
#angular/cli 15.0.5 (cli-only)
#schematics/angular 15.0.5 (cli-only)
rxjs 6.6.7 (cli-only)
typescript 4.9.4 (cli-only)
How do I resolve the part which shows Angular: <error>?
I have tried:
npm uninstall -g #angular/cli
npm i -g #angular/cli#15.0.5
But I get the same result.
in your case you should approve the version of the typescript.
I suppose, you have to upgrade your typescript version!
Yesterday I upgraded Angular to 11.2.14. I updated Angular with the Angular guide and used to command ng update #angular/cdk#11 #angular/cli#11 #angular/core#11 #angular/material#11
After the command was executed it took a very long time to install the packages.
After 45minutes I canceled the ng update command and I wanted to try the install the packages manually with npm install. Unfortunately npm install wasn't working as I expected it to work.
npm install gives me the following error
npm ERR! While resolving: project-name#0.0.0
npm ERR! Found: #angular/cdk#10.2.7
npm ERR! node_modules/#angular/cdk
npm ERR! #angular/cdk#"^10.2.7" from the root project
When I try npm install #angular/cdk#11 I got the same error when I try npm install
I also get the same error on Angular material, core, common, compiler, and animations.
I've tried different node versions, clear npm cache, delete node modules and delete the package-lock.json.
None of those things seem to work.
The package.json Angular packages
"#angular/animations": "~11.2.14",
"#angular/cdk": "^10.2.7",
"#angular/common": "~11.2.14",
"#angular/compiler": "~11.2.14",
"#angular/core": "~11.2.14",
"#angular/fire": "^6.1.4",
"#angular/flex-layout": "^10.0.0-beta.32",
"#angular/forms": "~11.2.14",
"#angular/localize": "^11.2.14",
"#angular/material": "^11.2.13",
"#angular/platform-browser": "~11.2.14",
"#angular/platform-browser-dynamic": "~11.2.14",
"#angular/router": "~11.2.14",
Below is the output of ng --version. I know that the Angular CLI not at the same version is then Angular itself but even when Angular was 11.2.14 the errors still occure
Angular CLI: 11.2.14
Node: 14.17.1
OS: win32 x64
Angular: 12.0.5 (cli-only)
... common, core
Ivy Workspace: Yes
Package Version
-------------------------------------------------------------
#angular-devkit/architect 0.1102.14
#angular-devkit/build-angular 0.1102.14
#angular-devkit/core 11.2.14
#angular-devkit/schematics 11.2.14
#angular/animations <error>
#angular/cdk <error>
#angular/cli 11.2.14
#angular/compiler <error>
#angular/compiler-cli <error>
#angular/fire <error>
#angular/flex-layout 10.0.0-beta.32
#angular/forms 11.2.14
#angular/language-service 11.2.14
#angular/localize 11.2.14
#angular/material <error>
#angular/platform-browser 11.2.14
#angular/platform-browser-dynamic 11.2.14
#angular/router 11.2.14
#schematics/angular 11.2.14
#schematics/update 0.1102.14
rxjs 6.6.3 (cli-only)
typescript 4.0.8
npm install --force or npm install --legacy-peers is not option because the packages wont be installed (and both commands are giving errors they can't find the Angular packges)
How can I resolve the error?
update
I've created a new project and copy paste the dependecies in the new package.json. After the npm install I got the same error. I believe the error occurs on global scope and not just the project scope.
I'm not sure how Angular gives undefined
ng --version global
Angular CLI: 12.0.5
Node: 14.17.1
Package Manager: npm 7.17.0
OS: win32 x64
Angular: undefined
...
Package Version
------------------------------------------------------
#angular-devkit/architect 0.1200.5 (cli-only)
#angular-devkit/core 12.0.5 (cli-only)
#angular-devkit/schematics 12.0.5 (cli-only)
#schematics/angular 12.0.5 (cli-only)
update
It looks like Angular is adding a extra ´´´""´´´. Where does the extra ´´´""´´´ come from?
I need to downgrade my angular cli from version 9 to version 8. I have tried the following:
npm uninstall -g #angular/cli
npm cache verify
npm install -g #angular/cli#8.x.x
whenever I reinstall it and run ng --version it will still output version 9 packages:
Node: 14.3.0
OS: darwin x64
Angular: 9.1.9
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes
Package Version
-----------------------------------------------------------
#angular-devkit/architect 0.901.7
#angular-devkit/build-angular 0.901.7
#angular-devkit/build-optimizer 0.901.7
#angular-devkit/build-webpack 0.901.7
#angular-devkit/core 7.3.9
#angular-devkit/schematics 7.3.9
#angular/cli 9.1.7
#ngtools/webpack 9.1.7
#schematics/angular 9.1.7
#schematics/update 0.901.7
rxjs 6.5.5
typescript 3.8.3
webpack 4.42.0
I really need to roll back to version 8 to fix a breaking change, but am unable to get anything to change from version 9. Running ng serve with version 9 won't compile the app. Is there something I'm missing?
EDIT: I figured out that I had somehow installed a different version of the cli specific to the project that I was working in. I uninstalled both the local cli and the glocal cli and reran npm install -g #angular/cli#8.x.x. The ng --version output is correct now but when I try to run ng serve I get the following error: Cannot determine versions of "#angular/cli".
This likely means your local installation is broken. Please reinstall your packages.
this worked for me:
ng --version
npm uninstall -g #angular/cli
npm cache clean --force
npm install -g #angular/cli#8
ng --version
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
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#latest
Checked Angular version by running ng --version which gave me the following:
Angular CLI: 8.3.19
Node: 10.15.3
Cloned 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.
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
I need the drag and drop capabilities from the #angular/material module, but when I install it using angular cli, a bunch of vulnerabilities come out of the audit. The program works, but if I try to run npm audit fix, there is an error that the angular cli compiler module is not found.
How do I properly fix the vulnerabilities? npm update did not work.
Here's the output of ng --version:
Angular CLI: 7.2.4
Node: 10.16.1
OS: linux x64
Angular: 7.2.15
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
#angular-devkit/architect 0.12.4
#angular-devkit/build-angular 0.12.4
#angular-devkit/build-optimizer 0.12.4
#angular-devkit/build-webpack 0.12.4
#angular-devkit/core 7.2.4
#angular-devkit/schematics 7.2.4
#angular/cdk 8.1.2
#angular/cli 7.2.4
#angular/material 8.1.2
#ngtools/webpack 7.2.4
#schematics/angular 7.2.4
#schematics/update 0.12.4
rxjs 6.3.3
typescript 3.2.4
webpack 4.28.4
Here's what npm install in my project returns, apart from a few not installed peer dependencies:
audited 41915 packages in 5.767s
found 596 vulnerabilities (1 low, 2 moderate, 593 high)
run `npm audit fix` to fix them, or `npm audit` for details
The audit refers to angular cli, build-angular and so on - so all kinds of different packages.
You seem to be on an older version of Angular. Update to the latest version of Angular (you may have to update some code, particularly if you use lazily loaded modules), starting with the CLI. You can then use ng update followed by the packages you wish to update: http://angular.io/cli/update
Instead of npm install try npm install -d and try ng update to update angular version
This will not install npm globally. Then also there will be errors but when you run the project it will be work fine.