Skip to content

Crash for missing module at runtime after upgrade #947

@rosen-vladimirov

Description

@rosen-vladimirov

Description of the problem

I have a working app, that uses android 1.2.0 and ios 1.2.0. I've downloaded latest CLI (1.3.0) and I've decided to upgrade the runtimes. I prefer clean add, so I deleted node_modules and used the sequence:

tns platform remove android
tns platform add android

After that I built my app (after adding all new requirements) and after deploying on device/emulator, the application crashes that a module is missing.
I've checked the platforms/android directory and there's no tns_modules directory anywhere in the project. Also during build process I see warning that I have "tns_modules" directory under app dir, but it will not be used.

The Reason for the problem

With nativescript-cli 1.3.0, tns_modules directory should not be under app dir in your project. The modules are npm package called tns-core-modules. If you create new project with nativescript-cli 1.3.0 or later, you'll see tns-core-modules as dependency in the package.json of the project. For older projects, the modules are not added automatically and also the modules from app/tns_modules are not used.

Workarounds

First possible workaround is to add manually tns-core-modules in your package.json. You can execute:
npm install --save tns-core-modules
in the root of your project.

The other option is to create a new project, based on your existing one:

tns create newApp --copyFrom pathToOldApp

Possible solutions of the problem

Maybe CLI should add the tns-core-modules in package.json automatically. Another option is to use the modules from app/tns_modules in case there's no tns-core-modules defined in package.json.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions