Invalid rule result: Instance of class Promise

送分小仙女□ 提交于 2019-12-04 04:00:50

问题


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 )


回答1:


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.




回答2:


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)




回答3:


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.34.0/install.sh | bash

after installation install node version 10.x.x

nvm install 10

then switch in terminal like this

nvm use 10



回答4:


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.




回答5:


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!




回答6:


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.




回答7:


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




回答8:


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




回答9:


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




回答10:


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



来源:https://stackoverflow.com/questions/56647865/invalid-rule-result-instance-of-class-promise

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!