I installed latest Angular CLI and was trying to create a new app i am getting the below error. I uninstalled , cleaned cache , cleaned by forcing it , installed , updated npm...restarted computer :-) My versions Angular CLI: 6.1.2 Node: 8.11.3
13 Answers
In our case was old package: @angular/pwa Once we update it from: 0.6.8 to 0.7.5 everything started working fine.
I reinstalled NodeJS.
I deleted node_modules folder from user directory and hit npm install and it started working
Hi Shivprasad Koirala,
I had the same problem as you but the solution did not do it for me. Frankly speaking, it is a little bit odd that re-installing node.js fixes your problem because it should not conflict with Angular/CLI but in any case, good for you.
For my case, the solution was a bit different. I had accidentally once tried to create a new project in my username's folder. This was wrong, and I had canceled the procedure but it seems like that it had created one or two things. So in that case the steps are:
- Navigate to your username folder by opening windows explorer and typing in the address bar
%HomePath% - Check if the file
package.jsonand if the foldernode_moduleexist. If so, you can delete them safely.
If you have a Linux, again you need to navigate to your home directory and delete both those entries.
This worked for me:
npm uninstall -g @angular/clirm -rf node_modulesdelete
package-lock.jsonEdit
package.jsondevDependencies with these package versions:"@angular/cli": "6.0.8","@angular/compiler-cli": "6.0.4","@angular-devkit/build-ng-packagr": "~0.6.8","@angular-devkit/build-angular": "^0.6.8","@ngrx/schematics": "6.0.1","@nrwl/schematics": "6.0.4", (if using nrwl/nx)"ng-packagr": "^3.0.0-rc.2","typescript": "2.9.2"
npm install
I tried the other suggestions here, but ended up removing and re-installing Node.js and NPM.
Finally did the trick for me.
Updating all my angular schematic packages worked for me.
Angular CLI: 6.2.3
Node: 8.11.2
OS: darwin x64
Angular: 5.2.11
... animations, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic
... platform-server, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.6.8
@angular-devkit/build-angular 0.6.8
@angular-devkit/build-optimizer 0.8.3
@angular-devkit/core 0.8.3
@angular-devkit/schematics 0.8.3
@angular/cli 6.2.3
@angular/pwa 0.7.5
@ngtools/webpack 6.0.8
@schematics/angular 0.8.3
@schematics/update 0.8.3
rxjs 5.5.12
typescript 2.4.2
webpack 4.8.3
I tried the most repeated solution: reinstalling nodejs and angular cli, deleting node_modules and running npm i, but it did not work.
Finally, I tried upgrading angular schematics and it worked for me:
npm i -g @schematics/angular@7
npm i @schematics/angular@7
I had the same problem after upgrading @angular/cli to version 6.1.5. Downgrading it to 6.0.8 solved problem.
My problem had been occurring during ng g lib ...
First of, install node.js from here, and follow the steps below.
To install the Angular CLI:
npm install -g @angular/cli
To create project
ng new my-project //my-project is the name of the project
Change directory to project folder
cd my-project
To run the Angular project
ng serve
This happened to me after updating the project from v6 to v7. However, I missed updating @schematics/angular to a newer version. Apparently, there was some compatibility mismatch that wasn't noted in the package.jsons that caused this issue.
The best way I've found to figure out what the versions of stuff should be is to create a new project with the version of Angular you are trying to use. Once created, look at it's package.json to figure what versions should be compatible with what.
Try this trick, it will work :
Navigate to Parent Folders i.e.C Drive, Users, admin, download respectively and check if any angular files exist [ package.json, node_modules, etc.] and delete them.
In my case @schematics/angular was completely missing from my package.json -- not sure what happened.
Running
npm i @schematics/angular --save-dev
Fixed the issue for me.
I had a similar issue. I tried explicitly installing @schematics/angular and setting my default cli collection using:
npm i @schematics/angular --save-dev
ng config cli.defaultCollection @schematics/angular
It did not work for me.
So instead, since I'm already using ngrx in my project, I opted for @ngrx/schematics as my default.
npm i @ngrx/schematics -D
ng config cli.defaultCollection @ngrx/schematics
That worked for me.