Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xcode running on devices crashes with error unable to create file *.hot-update.json #4846

Closed
NickIliev opened this issue Jul 15, 2019 · 4 comments
Assignees
Labels
bug build Describes issues related to build operations
Milestone

Comments

@NickIliev
Copy link
Contributor

@isawk commented on Sun Jul 14 2019

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 6.0.0-2019-07-12-114039-13633
  • Cross-platform modules: 6.0.1
  • Android Runtime: 6.0.0
  • iOS Runtime: 6.0.0
  • Plugin(s): None added

Describe the bug
Running application on ios device fails with error

Terminating app due to uncaught exception 'NativeScript encountered a fatal error: Error: Failed to create file at path '/var/containers/Bundle/Application/BA77C164-AE79-4EDC-947B-0B6C369EAB1A/ns6rcdebugging.app/app/04cb1cf2b2dc45ef1917.hot-update.json'

See full stack trace below, before error

Screenshot 2019-07-14 at 04 11 35

2019-07-14 04:09:11.299939+0200 ns6rcdebugging[3432:1072010] *** Terminating app due to uncaught exception 'NativeScript encountered a fatal error: Error: Failed to create file at path '/var/containers/Bundle/Application/BA77C164-AE79-4EDC-947B-0B6C369EAB1A/ns6rcdebugging.app/app/04cb1cf2b2dc45ef1917.hot-update.json'
 at 
1   @file:///app/vendor.js:9436:326
2   getFile@file:///app/vendor.js:9379:150
3   getFile@file:///app/vendor.js:9436:304
4   e@file:///app/vendor.js:7209:308
5   exports@file:///app/vendor.js:7209:423
6   @file:///app/bundle.js:28:208
7   ./main.ts@file:///app/bundle.js:30:364
8   k@file:///app/runtime.js:75:17
9   n@file:///app/runtime.js:5:41
10  r@file:///app/runtime.js:4:31
11  anonymous@file:///app/bundle.js:1:183
12  evaluate@[native code]
13  moduleEvaluation@[native code]
14  promiseReactionJob@[native code]
', reason: '(null)'
*** First throw call stack:
(0x1c023927c 0x1bf4139f8 0x100e2e48c 0x100e6e028 0x100548f6c 0x1bfc8a8e0)
libc++abi.dylib: terminating with uncaught exception of type NSException

To Reproduce

$ tns create ${project-name} 

choose style (Angular)
choose template (Tabs)

$ cd ${project-name}
$ tns-migrate

Proceed to building the project as normal, below works with no errors.

$ tns build ios --env.aot --env.uglify --env.sourceMap --bundle

Open up project in xcode, after signing with provisioning profile etc, launch on device. All builds well but on run fails with reported error below.

Expected behavior
Sample application should run with no errors seems like a HMR issue, which is enabled even without --hmr flag been used.

Sample project
ns-6rc-debugging

Additional context

(Unrelated to above but bug I picked up when migrating project from 5 to 6)

Also noticed existing old NS 5 projects fail to build with error

/Users/KOGA/Development/mobile/impact-app/node_modules/webpack-cli/bin/cli.js:244
                                throw err;
                                ^

Error: Cannot find module '@ngtools/webpack/src/transformers'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (/Users/KOGA/Development/mobile/impact-app/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)

These are projects migrated from NS 5 to RC 6 using tns migrate command. Probably related to angular upgrade from 7 to 8.

@isawk
Copy link

isawk commented Jul 15, 2019

Screenshot 2019-07-15 at 10 04 01

I read somewhere changing build system to "Legacy Build System" would resolve issue, unfortunately that is not accurate. Am thinking this might be an issue with Angular 8, i created a new project after downgrading to below:

nativescript: 5.4.2
tns-core-modules: 5.4.3 
tns-android: 5.4.0
tns-ios: 5.4.2

However I still get same error, going to attempt to downgrade angular to 7, see if issue might be angular, I highly doubt it though

Angular version

Angular CLI: 8.1.1
Node: 10.16.0
OS: darwin x64
Angular: 8.0.3
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.801.1 (cli-only)
@angular-devkit/core         8.0.6
@angular-devkit/schematics   8.1.1 (cli-only)
@angular/http                8.0.0-beta.10
@ngtools/webpack             8.0.6
@schematics/angular          8.1.1 (cli-only)
@schematics/update           0.801.1 (cli-only)
rxjs                         6.5.2
typescript                   3.4.5
webpack                      4.27.1

@rosen-vladimirov rosen-vladimirov added bug build Describes issues related to build operations no-changelog The issue is present only in `next` versions and was not included in official version. labels Jul 15, 2019
@rosen-vladimirov rosen-vladimirov added this to the 6.0.0 milestone Jul 15, 2019
@rosen-vladimirov rosen-vladimirov modified the milestones: 6.0.0, 6.0.1 Jul 16, 2019
@rosen-vladimirov rosen-vladimirov removed the no-changelog The issue is present only in `next` versions and was not included in official version. label Jul 16, 2019
@rosen-vladimirov
Copy link
Contributor

rosen-vladimirov commented Jul 16, 2019

Hey @isawk ,
Thank you for the report. Currently when you do not pass --release flag to the command, CLI enables Hot Module Replacement (HMR) by default. When the application with HMR enabled is run on device, it tries to create some files, but it does not have permissions to do so. We'll update our CLI to enable HMR only when run, debug or preview command is executed. When you run prepare or build, we'll not enable it and this way you'll be able to run your application through Xcode.
As a workaround you can pass --release flag to your build command - this way CLI will not enable HMR and you'll be able to continue using Xcode.
Can you give it a try and inform us if the suggested workaround works on your side?

Fatme added a commit that referenced this issue Jul 16, 2019
NativeScript CLI doesn't respect correctly `hmr: false` when the option is provided through dashed options from command. This led to the exception when the application is built using CLI and deployed on device using Xcode as the `hmr` is included in app's bundle.

Fixes:
#4846
#4814
Fatme added a commit that referenced this issue Jul 16, 2019
NativeScript CLI doesn't respect correctly `hmr: false` when the option is provided through dashed options from command. This led to the exception when the application is built using CLI and deployed on device using Xcode as the `hmr` is included in app's bundle.

Fixes:
#4846
#4814
Fatme added a commit that referenced this issue Jul 16, 2019
NativeScript CLI doesn't respect correctly `hmr: false` when the option is provided through dashed options from command. This led to the exception when the application is built using CLI and deployed on device using Xcode as the `hmr` is included in app's bundle.

Fixes:
#4846
#4814
@isawk
Copy link

isawk commented Jul 16, 2019 via email

@SephReed
Copy link

SephReed commented Oct 2, 2019

in terminal run tns build ios --release

Then go to xcode and run build or archive. Apparently xcode does not recompile the js bundle.

Also, THANK YOU SO MUCH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug build Describes issues related to build operations
Projects
None yet
Development

No branches or pull requests

6 participants