NativeScript / nx

NativeScript for Nx.
Other
64 stars 17 forks source link

Apple M1 build failed #12

Closed SergioZhydecky closed 2 years ago

SergioZhydecky commented 3 years ago

I'm trying to build an app on a mac with M1 CPU, but getting next:

> nx run nativescript-app:ios 
Searching for devices...
Preparing project...
webpack is watching the files...
assets by path *.js 16.8 MiB
  asset vendor.js 16.5 MiB [compared for emit] (name: vendor) (id hint: defaultVendor)
  asset bundle.js 260 KiB [compared for emit] (name: bundle)
  asset src_features_home_home_module_ts.js 15.7 KiB [compared for emit]
asset tns_modules/inspector_modules.js 89.2 KiB [compared for emit] (name: tns_modules/inspector_modules)
asset assets/images/nx-nativescript.png 45 KiB [compared for emit] [from: src/assets/images/nx-nativescript.png] [copied]
Entrypoint bundle 16.7 MiB = vendor.js 16.5 MiB bundle.js 260 KiB
Entrypoint tns_modules/inspector_modules 16.6 MiB = vendor.js 16.5 MiB tns_modules/inspector_modules.js 89.2 KiB
orphan modules 228 KiB [orphan] 132 modules
runtime modules 50.2 KiB 28 modules
modules by path ./ 6.23 MiB 319 modules
modules by path ../../node_modules/rxjs/_esm5/internal/ 95.8 KiB
  modules by path ../../node_modules/rxjs/_esm5/internal/util/*.js 10.7 KiB 24 modules
  modules by path ../../node_modules/rxjs/_esm5/internal/operators/*.js 31 KiB 21 modules
  modules by path ../../node_modules/rxjs/_esm5/internal/*.js 32.2 KiB 11 modules
  modules by path ../../node_modules/rxjs/_esm5/internal/observable/*.js 15.8 KiB 10 modules
  modules by path ../../node_modules/rxjs/_esm5/internal/scheduled/*.js 5.24 KiB 5 modules
  modules by path ../../node_modules/rxjs/_esm5/internal/symbol/*.js 887 bytes
    ../../node_modules/rxjs/_esm5/internal/symbol/rxSubscriber.js 334 bytes [built] [code generated]
    ../../node_modules/rxjs/_esm5/internal/symbol/observable.js 218 bytes [built] [code generated]
    ../../node_modules/rxjs/_esm5/internal/symbol/iterator.js 335 bytes [built] [code generated]
external "~/package.json" 42 bytes [optional] [built] [code generated]
webpack 5.31.2 compiled successfully in 7183 ms
Webpack compilation complete. Watching for file changes.
File change detected. Starting incremental webpack compilation...
Installing pods...
arch: posix_spawnp: pod: Bad CPU type in executable
'arch install' command failed.

Done.

The command $ns run ios works if an application is created outside nx workspace.

NathanWalker commented 3 years ago

This is likely related to Cocoapods and/or terminal not running under Rosetta. You can try these tips here: https://dev.to/courier/tips-and-tricks-to-setup-your-apple-m1-for-development-547g (notably the terminal under rosetta option). As well as see a few M1 specific notes in env setup here: https://docs.nativescript.org/environment-setup.html#macos-ios can search the page for "Additional notes for M1 based machines"