ionic-team / ionic-cli

The Ionic command-line interface
MIT License
1.99k stars 640 forks source link

An unhandled exception occurred: Cannot read properties of undefined (reading 'split') #5074

Closed redafillali closed 2 months ago

redafillali commented 4 months ago

Description: When I run : Ionic cordova run android -l

I get this error [ng] An unhandled exception occurred: Cannot read properties of undefined (reading 'split') [ng] See "/private/var/folders/76/b6pv5q953_x7jd6jk4nx5vl80000gn/T/ng-lsQceK/angular-errors.log" for further details.

angular-errors.log content : [error] TypeError: Cannot read properties of undefined (reading 'split') at targetFromTargetString (/node_modules/@ionic/cordova-builders/node_modules/@angular-devkit/build-angular/node_modules/@angular-devkit/architect/src/api.js:57:23) at normalizeOptions (/node_modules/@ionic/cordova-builders/node_modules/@angular-devkit/build-angular/src/builders/dev-server/options.js:32:66) at async initialize (/node_modules/@ionic/cordova-builders/node_modules/@angular-devkit/build-angular/src/builders/dev-server/builder.js:69:31)

Steps to Reproduce: Create a new projet with ionic cordova using angular 17 run the command Ionic cordova run android -l

Output:

`> ng run app:ionic-cordova-serve --host=localhost --port=8100 --platform=ios [ng] An unhandled exception occurred: Cannot read properties of undefined (reading 'split') [ng] See "/private/var/folders/76/b6pv5q953_x7jd6jk4nx5vl80000gn/T/ng-EbpAOn/angular-errors.log" for further details. ionic:lib:serve received unexpected close for ng (code: 127) +2s

[ERROR] ng has unexpectedly closed (exit code 127).

    The Ionic CLI will exit. Please check any output above for error details.

ionic:utils-process onBeforeExit handler: 'process.exit' received +0ms ionic:utils-process onBeforeExit handler: running 1 functions +1ms ionic:utils-process processExit: exiting (exit code: 1) +23ms`

My ionic info:

Error loading @ionic/angular package.json: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package' is
       not defined by "exports" in
       /node_modules/@ionic/angular/package.json

Ionic:

   Ionic CLI                     : 6.20.9 (/opt/homebrew/lib/node_modules/@ionic/cli)
   Ionic Framework               : not installed
   @angular-devkit/build-angular : 17.0.10
   @angular-devkit/schematics    : 17.0.10
   @angular/cli                  : 17.0.10
   @ionic/angular-toolkit        : 9.0.0

Cordova:

   Cordova CLI       : 12.0.0 (cordova-lib@12.0.1)
   Cordova Platforms : android 12.0.1, ios 7.0.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 11 other plugins)

Utility:

   cordova-res : 0.15.4
   native-run  : 2.0.0

System:

   ios-sim : 8.0.2
   NodeJS  : v20.10.0 (/opt/homebrew/Cellar/node@20/20.10.0/bin/node)
   npm     : 10.2.3
   OS      : macOS Unknown
   Xcode   : Xcode 15.2 Build version 15C500b
naitikpatel1990 commented 2 months ago

@redafillali

Do you found any solution for this?

redafillali commented 2 months ago

@redafillali

Do you found any solution for this?

Yes I changed a lot of things, This is my **ionic info** output

Ionic:

   Ionic CLI                     : 7.2.0 (/opt/homebrew/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 7.6.6
   @angular-devkit/build-angular : 17.1.1
   @angular-devkit/schematics    : 17.1.1
   @angular/cli                  : 17.1.1
   @ionic/angular-toolkit        : 9.0.0

Cordova:

   Cordova CLI       : 12.0.0 (cordova-lib@12.0.1)
   Cordova Platforms : android 12.0.1, ios 7.0.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 15 other plugins)

Utility:

   cordova-res                          : 0.15.4
   native-run (update available: 2.0.1) : 2.0.0

System:

   ios-deploy : 1.12.2
   ios-sim    : 8.0.2
   NodeJS     : v20.10.0 (/opt/homebrew/Cellar/node@20/20.10.0/bin/node)
   npm        : 10.2.3
   OS         : macOS Unknown
   Xcode      : Xcode 15.2 Build version 15C500b`
mapsandapps commented 2 months ago

Hi, it sounds like you were able to resolve this by updating packages. I'll close this issue. If you come across this again, feel free to open a new issue. Thanks!