Invalid rule result: Instance of class Promise

Viewed 21096

I work with Angular 7.1.4. I want to generate a new module with the following line;

ng g m order-process

But I encountered an error:

Invalid rule result: Instance of class Promise.

How to fix this? Node: 8.11.3


package.json ( https://prnt.sc/o3cg54 )

12 Answers

I'd solved my problem. My angular/cli version is 7.0.7 but I was find the @schematics/angular@8.0.3 in package-lock.json. So, I run the "npm install @schematics/angular@7.0.7 --save-dev" command and solved my problem. Thank you for interested.

Run npm install @schematics/angular@7.0.7 --save-dev replace version with the same as your @angular/cli (in this scenario, 7.0.7)

My problem was that my node version was on 8.x.x but angular >= 8.x.x requires a node version >= 10.x.x

Im using nvm to change node version. Install it with like so (check link for windows usage)

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash

after installation install node version 10.x.x

nvm install 10

then switch in terminal like this

nvm use 10

Had this issue while using Using: @angular/cli 8.1.1, @angular-devkit/schematics 8.0.1, Node v8.9.4, Upgrading to Node 10 fixed it.

Deleting existing package-lock.json and node_modules directory helped me running the ng new command without error

Angular CLI: 8.0.3 Node: 10.16.0 OS: darwin x64 Angular: 7.2.7

I also encountered this problem, but it was resolved when I chose to reinstall node!I hope I can help you!

This answer is not related to the initial question, but since this is the first hit in google for the error message, I'll leave some information here for everybody seeing this error when upgrading Apollo (apollo-angular) from 1.x to 2.x with ng update apollo-angular.

Check if you have installed @angular-devkit/schematics and if it is the same version as your @angular/cli package.
If not install with @angular-devkit/schematics@<your.@angular/cli.version>. Then commit the changes, make sure you don't commit the changed Apollo version from the failed run and try again.

Try to generate a blank new project and check if you get the same error there too when creating a module using the CLI.

If you do, then I'd recommend to re-install angular.

Try to install the CLI version 6.0.8 and then install in a clean project try ng add @angular/pwa@0.6.8

Seems like the error hasn't been solved by the core team so in the meanwhile we have to use a lower version

It is an error in node. It works with carrying out 3 steps 1.- Uninstall and reinstall the (last) version of the node 2.- Inside the project, delete the package-lock.json file (it will be automatically regenerated) and the node_modules folder 3.- run npm install to reload the node_modules

make sure that your angular cli version and @schematics/angular should be same then only ng add @angular/pwa < project name same as in angular.json file >

will execute and run successfully and the service worker module will be added to the project

Related