nstudio / xplat

Cross-platform (xplat) tools for Nx workspaces.
MIT License
369 stars 52 forks source link

[nativescript-angular-monorepo] Cannot build Angular 16.0.0 #322

Closed dackyD closed 1 year ago

dackyD commented 1 year ago

I followed the procedure as stated in the docs.

$ npx create-nx-workspace@16.5.0 ns-ui-repo

 >  NX   Let's create a new workspace [https://nx.dev/getting-started/intro]

✔ Which stack do you want to use? · none
✔ Package-based or integrated? · integrated
✔ Enable distributed caching to make your CI faster · No

 >  NX   Creating your v16.5.0 workspace.

   To make sure the command works reliably in all environments, and that the preset is applied correctly,
   Nx will run "npm install" several times. Please wait.

✔ Installing dependencies with npm
✔ Successfully created the workspace: ns-ui-repo.

$ cd ns-ui-repo/
$ npm install @nx/js -D
$ npx nx g @nx/js:init

>  NX  Generating @nx/js:init

Fetching prettier...
CREATE tsconfig.base.json
CREATE .prettierrc
CREATE .prettierignore
UPDATE .vscode/extensions.json
UPDATE package.json

added 1 package, removed 1 package, and audited 368 packages in 1s

31 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

$ npm install @nstudio/xplat -D
$ npx nx g @nstudio/xplat:app insight

>  NX  Generating @nstudio/xplat:application

✔ What type of app would like to create? · nativescript
✔ In which directory should the app be generated? (Just press Enter for the default: directly in 'apps') · 
✔ Would you like to configure routing for this app? (Y/n) · true
✔ Which frontend framework should it use? · angular
✔ Use xplat supporting architecture? (Y/n) · true
✔ Packages installed successfully.

> XPLAT  You will be able to run your app with:

  nx run nativescript-insight:ios

  nx run nativescript-insight:android

  You can also:

  nx run nativescript-insight:clean
 ...

Then I started the ios simulator and ran the following command

nx run nativescript-insight:ios

Here is the full output when running nativescript angular on ios

$ nx run nativescript-insight:ios

> nx run nativescript-insight:ios

―――――――――――――――――――――――― 
Running NativeScript CLI within apps/nativescript-insight

ns debug ios --force

---
Searching for devices...

> insight@0.0.0 postinstall
> node ./tools/xplat-postinstall.js

Copying ../../hooks -> hooks

added 25 packages, and audited 26 packages in 6s

1 package is looking for funding
  run `npm fund` for details

found 0 vulnerabilities

> insight@0.0.0 postinstall
> node ./tools/xplat-postinstall.js

Copying ../../hooks -> hooks

up to date, audited 26 packages in 671ms

1 package is looking for funding
  run `npm fund` for details

found 0 vulnerabilities
Copying template files...
Platform ios successfully added. v8.5.2
Preparing project...
webpack is watching the files...
assets by path *.js 18.3 MiB
  asset vendor.js 17.9 MiB [emitted] (name: vendor) (id hint: defaultVendor)
  asset bundle.js 375 KiB [emitted] (name: bundle)
  asset runtime.js 88.5 KiB [emitted] (name: runtime)
  asset src_features_home_home_module_ts.js 7.77 KiB [emitted]
asset fonts/fontawesome-webfont.ttf 162 KiB [emitted] [from: src/fonts/fontawesome-webfont.ttf] [copied]
asset tns_modules/inspector_modules.js 1.22 KiB [emitted] (name: tns_modules/inspector_modules)
asset assets/i18n/en.json 29 bytes [emitted] [from: src/assets/i18n/en.json] [copied]
Entrypoint bundle 18.3 MiB = runtime.js 88.5 KiB vendor.js 17.9 MiB bundle.js 375 KiB
Entrypoint tns_modules/inspector_modules 18 MiB = runtime.js 88.5 KiB vendor.js 17.9 MiB tns_modules/inspector_modules.js 1.22 KiB
runtime modules 25.4 KiB 13 modules
orphan modules 9.04 KiB [orphan] 9 modules
modules by path ./ 2.66 MiB 340 modules
modules by path ../../ 3.18 MiB
  modules by path ../../node_modules/rxjs/dist/cjs/internal/ 280 KiB 224 modules
  modules by path ../../libs/xplat/ 56.4 KiB 45 modules
  modules by path ../../node_modules/@nativescript/ 331 KiB
    modules by path ../../node_modules/@nativescript/zone-js/dist/*.js 32 KiB 8 modules
    ../../node_modules/@nativescript/angular/fesm2022/nativescript-angular.mjs 295 KiB [built] [code generated]
    ../../node_modules/@nativescript/webpack/dist/loaders/angular-hot-loader...(truncated) 3.61 KiB [built] [code generated]
  modules by path ../../node_modules/@angular/ 2.31 MiB 9 modules
  + 6 modules
external "~/package.json" 42 bytes [optional] [built] [code generated]

ERROR in ../../libs/xplat/nativescript/core/src/lib/core.module.ts:35:12 - error NG6002: 'TNSFontIconModule' does not appear to be an NgModule class.

 35   imports: [
               ~
 36     NativeScriptModule,
    ~~~~~~~~~~~~~~~~~~~~~~~
... 
 54     }),
    ~~~~~~~
 55   ],
    ~~~

  ../../node_modules/nativescript-ngx-fonticon/index.d.ts:5:22
    5 export declare class TNSFontIconModule {
                           ~~~~~~~~~~~~~~~~~
    This likely means that the library (nativescript-ngx-fonticon) which declares TNSFontIconModule is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

ERROR in ../../libs/xplat/nativescript/features/src/lib/ui/ui.module.ts:22:12 - error NG6002: 'TNSFontIconModule' does not appear to be an NgModule class.

22   imports: [...MODULES],
              ~~~~~~~~~~~~

  ../../node_modules/nativescript-ngx-fonticon/index.d.ts:5:22
    5 export declare class TNSFontIconModule {
                           ~~~~~~~~~~~~~~~~~
    This likely means that the library (nativescript-ngx-fonticon) which declares TNSFontIconModule is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

ERROR in ../../libs/xplat/nativescript/features/src/lib/ui/ui.module.ts:24:12 - error NG6003: 'TNSFontIconModule' does not appear to be an NgModule, Component, Directive, or Pipe class.

24   exports: [...MODULES, ...UI_COMPONENTS],
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  ../../node_modules/nativescript-ngx-fonticon/index.d.ts:5:22
    5 export declare class TNSFontIconModule {
                           ~~~~~~~~~~~~~~~~~
    This likely means that the library (nativescript-ngx-fonticon) which declares TNSFontIconModule is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

ERROR in src/app.module.ts:11:13 - error NG6002: This import contains errors, which may affect components that depend on this NgModule.

11   imports: [CoreModule, SharedModule, AppRoutingModule],
               ~~~~~~~~~~

ERROR in src/app.module.ts:11:25 - error NG6002: This import contains errors, which may affect components that depend on this NgModule.

11   imports: [CoreModule, SharedModule, AppRoutingModule],
                           ~~~~~~~~~~~~

ERROR in src/app.module.ts:11:39 - error NG6002: This import contains errors, which may affect components that depend on this NgModule.

11   imports: [CoreModule, SharedModule, AppRoutingModule],
                                         ~~~~~~~~~~~~~~~~

ERROR in src/app.routing.ts:25:13 - error NG6002: This import contains errors, which may affect components that depend on this NgModule.

25   imports: [SharedModule, NativeScriptRouterModule.forRoot(routes)]
               ~~~~~~~~~~~~

ERROR in src/core/core.module.ts:7:13 - error NG6002: This import contains errors, which may affect components that depend on this NgModule.

7   imports: [NsUiRepoCoreModule]
              ~~~~~~~~~~~~~~~~~~

ERROR in src/features/home/home.module.ts:20:13 - error NG6002: This import contains errors, which may affect components that depend on this NgModule.

20   imports: [SharedModule, NativeScriptRouterModule.forChild(routes)],
               ~~~~~~~~~~~~

ERROR in src/features/shared/shared.module.ts:9:12 - error NG6002: This import contains errors, which may affect components that depend on this NgModule.

9   imports: [...MODULES],
             ~~~~~~~~~~~~

ERROR in src/features/shared/shared.module.ts:10:12 - error NG6003: This export contains errors, which may affect components that depend on this NgModule.

10   exports: [...MODULES]
              ~~~~~~~~~~~~

webpack 5.86.0 compiled with 11 errors in 18018 ms
Webpack compilation complete. Watching for file changes.

> insight@0.0.0 postinstall
> node ./tools/xplat-postinstall.js

Copying ../../hooks -> hooks

up to date, audited 26 packages in 690ms

1 package is looking for funding
  run `npm fund` for details

found 0 vulnerabilities
Installing pods...
Analyzing dependencies
Downloading dependencies
Generating Pods project
Integrating client project

[!] Please close any current Xcode sessions and use `nativescriptinsight.xcworkspace` for this project from now on.
Pod installation complete! There are 0 dependencies from the Podfile and 0 total pods installed.

[!] The Podfile does not contain any dependencies.
Updating runtime package.json with configuration values...
Project successfully prepared (ios)
Building project...
Xcode build...
2023-08-04 09:55:27.208 xcodebuild[16879:140768] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)
./.build_env_vars.sh: line 531: declare: UID: readonly variable
NSLD: Swift bridging header '*-Swift.h' not found under '/Users/hdd/Library/Developer/Xcode/DerivedData/nativescriptinsight-fxaryonvsdydapdzsyygcyufdzxa/Build/Intermediates.noindex/nativescriptinsight.build/Debug-iphonesimulator/nativescriptinsight.build/Objects-normal/x86_64'
Generating metadata...~/Dev/Xplat/ns-ui-repo/apps/nativescript-insight/platforms/ios/internal/metadata-generator-x86_64/bin ~/Dev/Xplat/ns-ui-repo/apps/nativescript-insight/platforms/ios
Python version: 3.9.6 (default, May  7 2023, 23:32:45) 
[Clang 14.0.3 (clang-1403.0.22.14.1)]
Generating metadata for x86_64
Metadata Generator Arguments: 
./objc-metadata-generator -verbose -output-bin /Users/hdd/Dev/Xplat/ns-ui-repo/apps/nativescript-insight/platforms/ios/build/Debug-iphonesimulator/metadata-x86_64.bin -output-umbrella /Users/hdd/Dev/Xplat/ns-ui-repo/apps/nativescript-insight/platforms/ios/build/Debug-iphonesimulator/umbrella-x86_64.h -docset-path /Users/hdd/Library/Developer/Shared/Documentation/DocSets/com.apple.adc.documentation.iOS.docset Xclang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.4.sdk -std=gnu99 -target x86_64-apple-ios16.4-simulator -I/Users/hdd/Dev/Xplat/ns-ui-repo/apps/nativescript-insight/platforms/ios/build/Debug-iphonesimulator/include -I/Users/hdd/Dev/Xplat/ns-ui-repo/apps/nativescript-insight/platforms/ios/internal/Swift-Modules -I/Users/hdd/Dev/Xplat/ns-ui-repo/apps/nativescript-insight/platforms/ios/internal -I/Users/hdd/Dev/Xplat/ns-ui-repo/apps/nativescript-insight/platforms/ios/../../App_Resources/iOS/src -I/Users/hdd/Dev/Xplat/ns-ui-repo/apps/nativescript-insight/platforms/ios/../../../../node_modules/@nativescript/core/platforms/ios/src -F/Users/hdd/Dev/Xplat/ns-ui-repo/apps/nativescript-insight/platforms/ios/build/Debug-iphonesimulator -F/Users/hdd/Dev/Xplat/ns-ui-repo/apps/nativescript-insight/platforms/ios/internal/ -F/Users/hdd/Dev/Xplat/ns-ui-repo/apps/nativescript-insight/platforms/ios/build/Debug-iphonesimulator -F/Users/hdd/Dev/Xplat/ns-ui-repo/apps/nativescript-insight/platforms/ios/../../../../node_modules/@nativescript/core/platforms/ios -DCOCOAPODS=1 -DDEBUG=1 
Clang Arguments: 
"-v", "-x", "objective-c", "-fno-objc-arc", "-fmodule-maps", "-ferror-limit=0", "-Wno-unknown-pragmas", "-Wno-ignored-attributes", "-Wno-nullability-completeness", "-Wno-expansion-to-defined", "-D__NATIVESCRIPT_METADATA_GENERATOR=1", "-isysroot", "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.4.sdk", "-std=gnu99", "-target", "x86_64-apple-ios16.4-simulator", "-I/Users/hdd/Dev/Xplat/ns-ui-repo/apps/nativescript-insight/platforms/ios/build/Debug-iphonesimulator/include", "-I/Users/hdd/Dev/Xplat/ns-ui-repo/apps/nativescript-insight/platforms/ios/internal/Swift-Modules", "-I/Users/hdd/Dev/Xplat/ns-ui-repo/apps/nativescript-insight/platforms/ios/internal", "-I/Users/hdd/Dev/Xplat/ns-ui-repo/apps/nativescript-insight/platforms/ios/../../App_Resources/iOS/src", "-I/Users/hdd/Dev/Xplat/ns-ui-repo/apps/nativescript-insight/platforms/ios/../../../../node_modules/@nativescript/core/platforms/ios/src", "-F/Users/hdd/Dev/Xplat/ns-ui-repo/apps/nativescript-insight/platforms/ios/build/Debug-iphonesimulator", "-F/Users/hdd/Dev/Xplat/ns-ui-repo/apps/nativescript-insight/platforms/ios/internal/", "-F/Users/hdd/Dev/Xplat/ns-ui-repo/apps/nativescript-insight/platforms/ios/build/Debug-iphonesimulator", "-F/Users/hdd/Dev/Xplat/ns-ui-repo/apps/nativescript-insight/platforms/ios/../../../../node_modules/@nativescript/core/platforms/ios", "-DCOCOAPODS=1", "-DDEBUG=1", 
Merged 1093 categories.
Result: 55683 declarations from 174 top level modules
Done! Running time: 6.22097 sec 
Saving metadata generation's stderr stream to: /Users/hdd/Dev/Xplat/ns-ui-repo/apps/nativescript-insight/platforms/ios/build/Debug-iphonesimulator/metadata-generation-stderr-x86_64.txt
~/Dev/Xplat/ns-ui-repo/apps/nativescript-insight/platforms/ios
ld: warning: object file (/Users/hdd/Dev/Xplat/ns-ui-repo/apps/nativescript-insight/platforms/ios/build/Debug-iphonesimulator/Pods_nativescriptinsight.framework/Pods_nativescriptinsight(Pods_nativescriptinsight_vers.o)) was built for newer iOS Simulator version (13.0) than being linked (12.0)
ld: warning: object file (/Users/hdd/Dev/Xplat/ns-ui-repo/apps/nativescript-insight/platforms/ios/build/Debug-iphonesimulator/Pods_nativescriptinsight.framework/Pods_nativescriptinsight(Pods-nativescriptinsight-dummy.o)) was built for newer iOS Simulator version (13.0) than being linked (12.0)
note: Using codesigning identity override: 
note: Building targets in dependency order
note: Removed stale file '/Users/hdd/Library/Developer/Xcode/DerivedData/nativescriptinsight-fxaryonvsdydapdzsyygcyufdzxa/Build/Intermediates.noindex/nativescriptinsight.build/Debug-iphonesimulator/nativescriptinsight.build/Script-DAD08C8EE71E29BC94B970BD.sh'

note: Run script build phase 'NativeScript PreBuild' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'nativescriptinsight' from project 'nativescriptinsight')
note: Run script build phase 'NativeScript PostBuild' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'nativescriptinsight' from project 'nativescriptinsight')
note: Run script build phase 'NativeScript PreLink' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'nativescriptinsight' from project 'nativescriptinsight')
Project successfully built.
Build time: 22.901 s.
The build result is located at: /Users/hdd/Dev/Xplat/ns-ui-repo/apps/nativescript-insight/platforms/ios/build/Debug-iphonesimulator/nativescriptinsight.app
Installing on device BDD1DBCB-0B39-4243-838E-47198ED8CE09...
Successfully installed on device with identifier 'BDD1DBCB-0B39-4243-838E-47198ED8CE09'.
Successfully transferred all files on device BDD1DBCB-0B39-4243-838E-47198ED8CE09.
Restarting application on device BDD1DBCB-0B39-4243-838E-47198ED8CE09...
  [HMR][b268b6b12deaf220600f] boot | HMR Enabled - waiting for changes...
  JIT compilation failed for NgModule class AppModule {
  }
  bootstrap: Error in Bootstrap Function:
  The NgModule 'AppModule' needs to be compiled using the JIT compiler, but '@angular/compiler' is not available.
  JIT compilation is discouraged for production use-cases! Consider using AOT mode instead.
  Alternatively, the JIT compiler should be loaded by bootstrapping using '@angular/platform-browser-dynamic' or '@angular/platform-server',
  or manually provide the compiler with 'import "@angular/compiler";' before bootstrapping.
  Error: The NgModule 'AppModule' needs to be compiled using the JIT compiler, but '@angular/compiler' is not available.
  JIT compilation is discouraged for production use-cases! Consider using AOT mode instead.
  Alternatively, the JIT compiler should be loaded by bootstrapping using '@angular/platform-browser-dynamic' or '@angular/platform-server',
  or manually provide the compiler with 'import "@angular/compiler";' before bootstrapping.
  at getCompilerFacade (file: src/webpack:/insight/node_modules/@angular/core/fesm2022/core.mjs:5107:14)
  at AppModule.get (file://<…>
  NativeScript debugger has opened inspector socket on port 18183 for org.nativescript.insight.
'--chrome' is the default behavior. Use --inspector to debug iOS applications using the Safari Web Inspector.

Setting up debugger proxy...
Press Ctrl + C to terminate, or disconnect.

Opened localhost 41000
To start debugging, open the following URL in Chrome:
devtools://devtools/bundled/inspector.html?ws=localhost:41000

Successfully synced application org.nativescript.insight on device BDD1DBCB-0B39-4243-838E-47198ED8CE09.

Here is also my output when running ns-doctor inside apps/nativescript-insight

$ cd apps/nativescript-insight/
$ ns doctor

✔ Getting environment information 

No issues were detected.
✔ Your ANDROID_HOME environment variable is set and points to correct directory.
✔ Your adb from the Android SDK is correctly installed.
✔ The Android SDK is installed.
✔ A compatible Android SDK for compilation is found.
✔ Javac is installed and is configured properly.
✔ The Java Development Kit (JDK) is installed and is configured properly.
✔ Xcode is installed and is configured properly.
✔ xcodeproj is installed and is configured properly.
✔ CocoaPods are installed.
✔ CocoaPods update is not required.
✔ CocoaPods are configured properly.
✔ Your current CocoaPods version is newer than 1.0.0.
✔ Python installed and configured correctly.
✔ The Python 'six' package is found.
✔ Xcode version 14.3.1 satisfies minimum required version 10.
✔ Getting NativeScript components versions information...
✔ Component nativescript has 8.5.3 version and is up to date.
✔ Component @nativescript/core has 8.5.9 version and is up to date.
✔ Component @nativescript/ios has 8.5.2 version and is up to date.
✔ Component @nativescript/android has 8.5.1 version and is up to date.

And more info

$ node --version
v18.16.0
$ npm --version
9.5.1
$ ns --version
8.5.3
✔ Up to date.
NathanWalker commented 1 year ago

Thanks for mention @dackyD just published the update, 16.5.9, which has it resolved and using the ng16 fonticon module now. going through same creation steps should be fine, lemme know if further issue.

dackyD commented 1 year ago

Thanks. Pleasure of making xplat better :)