Cannot find module '@schematics/angular/utility/project'

user13057679 picture user13057679 · Jul 15, 2020 · Viewed 11.3k times · Source

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 ([email protected])
     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
    

Answer

Abbas Fatullaev picture Abbas Fatullaev · Jul 19, 2020

Seems like it's an ionic incompatibility with angular 10+

THIS WORKED FOR ME

npm uninstall @schematics/angular
npm install @schematics/[email protected]