If I do ionic generate component xxx
An unhandled exception occurred: Cannot find module '@schematics/angular/utility/project' Require stack:
- /Users/user/develop/myapp/node_modules/@ionic/angular-toolkit/schematics/component/index.js
- /Users/user/develop/myapp/node_modules/@angular-devkit/schematics/tools/export-ref.js
- /Users/user/develop/myapp/node_modules/@angular-devkit/schematics/tools/index.js
- /Users/user/develop/myapp/node_modules/@angular/cli/utilities/json-schema.js
- /Users/user/develop/myapp/node_modules/@angular/cli/models/command-runner.js
- /Users/user/develop/myapp/node_modules/@angular/cli/lib/cli/index.js
- /Users/user/develop/myapp/node_modules/@angular/cli/lib/init.js
- /Users/user/develop/myapp/node_modules/@angular/cli/bin/ng
Ionic:
Ionic CLI : 6.10.1 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.2.3
@angular-devkit/build-angular : 0.1000.2
@angular-devkit/schematics : 10.0.2
@angular/cli : 10.0.2
@ionic/angular-toolkit : 2.2.0
Capacitor:
Capacitor CLI : 2.1.2
@capacitor/core : 2.1.2
Cordova:
Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 8.1.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 7 other plugins)
Utility:
cordova-res : not installed
native-run : not installed
System:
ios-sim : 8.0.2
NodeJS : v12.18.1 (/usr/local/bin/node)
npm : 6.14.6
OS : macOS Catalina
Xcode : Xcode 11.5 Build version 11E608c
8条答案
按热度按时间idv4meu81#
看起来像是离子不相容
这对我很有效
dy2hfwbg2#
您可以首先在schematics/angular上执行npm uninstall,TERMINAL会通知您“已删除XX个软件包并审核XXXX个软件包”等,然后您可以在schematics/angular@9.1.0上执行npm install。
相应地,ng add ngx-bootstrap提供了:
添加️了“ Bootstrap
添加️了“ngx Bootstrap
ygya80vv3#
在我的情况下,这是有:
而不是“^2.2.0”
我的Angular :10.1.4。
我发现这一点后,创建新的离子项目升级离子CLI最新。
ivqmmu1c4#
The problem is schematics module incompatibility.
f3temu5u5#
请尝试以下代码
chhkpiq46#
这对我很有效。
8ftvxx2r7#
In my case, after failing with all kind of suggestions.
I update npm: https://www.hostingadvice.com/how-to/update-node-js-latest-version/
Later on Angular: https://update.angular.io/?v=13.0-14.0 and Ionic: https://ionicframework.com/docs/intro/upgrading-to-ionic-6
It works!!
ltqd579y8#
你能试着运行ng add @angular/pwa@13吗?