NativeScript / nativescript-angular

Integrating NativeScript with Angular
http://docs.nativescript.org/angular/tutorial/ng-chapter-0
Apache License 2.0
1.21k stars 241 forks source link

Updating tns version of Nativescript + Angular App #1432

Closed phatakrajan closed 6 years ago

phatakrajan commented 6 years ago

Make sure to check the existing issues in this repository

If there is no issue for your problem, tell us about it

Trying to upgrade my current app after following all steps mentioned on Upgrade page.

Which platform(s) does your issue occur on?

Please, provide the following version numbers that your issue occurs with:

tsconfig

{ "compilerOptions": { "module": "commonjs", "target": "es5", "experimentalDecorators": true, "emitDecoratorMetadata": true, "noEmitHelpers": true, "noEmitOnError": true, "lib": [ "es6", "dom", "es2015.iterable" ], "baseUrl": ".", "paths": { "": [ "./node_modules/tns-core-modules/", "./node_modules/" ], "~/": [ "app/*" ] } }, "exclude": [ "node_modules", "platforms", "*/.aot.ts" ] }

Please, tell us how to recreate the issue in as much detail as possible.

Please find below my package.json. If you can create a project with my project.json, i think it should recreate the issue.

Is there any code involved?

here are the logs while running tns update command.

Gradle build... Platform android successfully removed. Successfully removed plugin tns-core-modules Successfully removed plugin tns-core-modules-widgets Copying template files... Installing tns-android Adding 'es2015.iterable' lib to tsconfig.json... Project already targets TypeScript ~2.7.2 ../../app/modules/test/test.component.ts(4,22): error TS2307: Cannot find module 'ui/page'. ../../app/modules/test/test.component.ts(5,27): error TS2307: Cannot find module 'ui/text-field'. ../../app/modules/test/test.component.ts(11,31): error TS2307: Cannot find module 'application-settings'. ../../app/modules/test/test1/test1.component.ts(3,27): error TS2307: Cannot find module 'ui/text-field'. ../../app/modules/test/test1/test1.component.ts(4,22): error TS2307: Cannot find module 'ui/page'. ../../app/modules/test/test1/test1.component.ts(9,24): error TS2307: Cannot find module 'utils/utils'. ../../app/modules/test/test1/test1.component.ts(32,4): error TS2345: Argument of type '{ textView: TextView; returnKeyTitle: string; locale: string; noReturnKey: true; noDecimals: true...' is not assignable to parameter of type 'NumericKeyboardOptions'. Object literal may only specify known properties, and 'textView' does not exist in type 'NumericKeyboardOptions'. ../../app/modules/shared/loading/loading.component.ts(2,35): error TS2307: Cannot find module 'ui/activity-indicator'. ../../app/modules/staff/test2/test3-questions/test3-questions.component.ts(4,23): error TS2307: Cannot find module 'ui/label'. ../../app/modules/staff/test2/test3/test3.component.ts(12,27): error TS2307: Cannot find module '../../../../../node_modules/tns-core-modules/ui/text-field/text-field'. ../../app/modules/staff/test2/test3/test3.component.ts(13,34): error TS2307: Cannot find module '../../../../../node_modules/tns-core-modules/ui/editable-text-base/editable-text-base'. ../../app/modules/staff/test2/test3/test3.component.ts(14,30): error TS2307: Cannot find module 'application'. ../../app/modules/staff/test2/test3/test3.component.ts(56,20): error TS2339: Property 'push' does not exist on type 'ValueList'. ../../app/modules/staff/test2/test3/test3.component.ts(78,38): error TS2339: Property 'object' does not exist on type 'SelectedIndexChangedEventData'. ../../app/modules/staff/test2/test3/test3.component.ts(82,74): error TS2339: Property 'getItem' does not exist on type 'ValueList'. ../../app/modules/staff/test2/test3/test3.component.ts(84,44): error TS2339: Property 'getItem' does not exist on type 'ValueList'. ../../app/modules/staff/test2/test2.component.ts(4,27): error TS2307: Cannot find module 'data/observable'. ../../app/modules/staff/test2/test2.component.ts(6,31): error TS2307: Cannot find module 'application-settings'. ../../app/modules/staff/list/list.component.ts(13,31): error TS2307: Cannot find module 'application-settings'. ../../app/modules/staff/list/list.component.ts(22,25): error TS2307: Cannot find module 'utils/utils'. ../../app/modules/user-control/login/login.component.ts(2,27): error TS2307: Cannot find module 'data/observable'. ../../app/modules/user-control/login/login.component.ts(3,24): error TS2307: Cannot find module 'ui/button'. ../../app/modules/user-control/login/login.component.ts(8,22): error TS2307: Cannot find module 'ui/page'. ../../app/modules/user-control/login/login.component.ts(9,24): error TS2307: Cannot find module 'utils/utils'. ../../app/modules/user-control/login/login.component.ts(10,31): error TS2307: Cannot find module 'application-settings'. ../../app/modules/user-control/select-location/select-location.component.ts(7,27): error TS2307: Cannot find module 'data/observable'. ../../app/modules/user-control/select-location/select-location.component.ts(11,31): error TS2307: Cannot find module 'application-settings'. ../../app/services/internal/back/back.service.ts(2,30): error TS2307: Cannot find module 'application'. ../../app/services/internal/back/back.service.ts(4,31): error TS2307: Cannot find module 'application-settings'. ../nativescript-drop-down/drop-down.d.ts(16,33): error TS2307: Cannot find module 'data/observable-array'. ../nativescript-drop-down/drop-down.d.ts(17,62): error TS2307: Cannot find module 'ui/core/view'. ../nativescript-drop-down/drop-down.d.ts(18,30): error TS2307: Cannot find module 'ui/gestures/gestures'. ../nativescript-drop-down/drop-down.d.ts(19,29): error TS2307: Cannot find module 'ui/list-picker'. apiclient/index.d.ts(1,29): error TS2307: Cannot find module 'file-system'. apiclient/index.d.ts(2,23): error TS2307: Cannot find module 'http'. apiclient/index.d.ts(3,24): error TS2307: Cannot find module 'image-source'. batch/index.d.ts(1,28): error TS2307: Cannot find module 'data/observable'. batch/index.d.ts(2,33): error TS2307: Cannot find module 'data/observable-array'. bitmap-factory/index.d.ts(1,30): error TS2307: Cannot find module 'application'. bitmap-factory/index.d.ts(2,30): error TS2307: Cannot find module 'image-source'. enumerable/index.d.ts(1,28): error TS2307: Cannot find module 'data/observable'. enumerable/index.d.ts(2,33): error TS2307: Cannot find module 'data/observable-array'. enumerable/index.d.ts(3,30): error TS2307: Cannot find module 'data/virtual-array'. index.d.ts(2,30): error TS2307: Cannot find module 'application'. index.d.ts(7,33): error TS2307: Cannot find module 'data/observable-array'. index.d.ts(8,30): error TS2307: Cannot find module 'data/virtual-array'. xmlobjects/index.d.ts(1,28): error TS2307: Cannot find module 'data/observable'. Could not update the project!

Originally i had below package.json which i modified to have latest Angular version as per comments mentioned in

https://github.com/NativeScript/NativeScript/issues/5909

{ "description": "Test", "license": "SEE LICENSE", "readme": "Test", "repository": "", "nativescript": { "id": "org.nativescript.test", "tns-ios": { "version": "3.2.0" }, "tns-android": { "version": "3.4.2" } }, "dependencies": { "@angular/animations": "~4.4.1", "@angular/common": "~4.4.1", "@angular/compiler": "~4.4.1", "@angular/core": "~4.4.1", "@angular/forms": "~4.4.1", "@angular/http": "~4.4.1", "@angular/platform-browser": "~4.4.1", "@angular/router": "~4.4.1", "@types/lodash": "^4.14.85", "angular2-focus": "^1.1.1", "axios": "^0.17.0", "lodash": "^4.17.4", "nativescript-angular": "~4.4.0", "nativescript-checkbox": "^3.0.1", "nativescript-drop-down": "^3.2.5", "nativescript-filter-select": "^1.2.0", "nativescript-geolocation": "^4.2.0", "nativescript-i18n": "^0.2.4", "nativescript-localstorage": "^1.1.5", "nativescript-material-icons": "^1.0.3", "nativescript-ng2-fonticon": "^1.3.4", "nativescript-numeric-keyboard": "^3.0.3", "nativescript-orientation": "^2.2.0", "nativescript-theme-core": "~1.0.2", "nativescript-toolbox": "^3.0.1", "nativescript-unit-test-runner": "^0.3.4", "nativescript-webview-interface": "^1.4.2", "reflect-metadata": "~0.1.8", "rxjs": "~5.4.2", "tns-core-modules": "~3.2.0", "zone.js": "~0.8.2" }, "nativescript-i18n": { "customLangPath": "app/i18n" }, "devDependencies": { "babel-traverse": "6.26.0", "babel-types": "6.26.0", "babylon": "6.18.0", "chai": "^4.1.2", "codelyzer": "^3.0.1", "karma": "^1.7.1", "karma-chai": "^0.1.0", "karma-mocha": "^1.3.0", "karma-nativescript-launcher": "^0.4.0", "lazy": "1.0.11", "nativescript-dev-typescript": "~0.5.0", "typescript": "~2.4.2" } }

tsonevn commented 6 years ago

Hi @phatakrajan, Try to remove node_modules platforms and hooks folders and rebuild the project via tns run android. If the problem persists, please send us the project.

phatakrajan commented 6 years ago

@tsonevn I started looking at each plugin from package.json. Eventually i figured out that issue was coming because of package nativescript-toolbox. I am able to perform "tns update" successfully now. I feel that i used a very crude way to figure out the solution. Is there a better way that we can take in future?

tsonevn commented 6 years ago

Hi @phatakrajan, I am glad to hear that you were able to solve your issue. The tns update should not be affected by the third party plugins, created by the community and should update the versions of the main core framework dependencies. In this case, the only way is to check which plugin is causing the issue manually. Also if you are facing any issues with the plugins, created by the community, you can contact the authors while using the plugin's repository.

Ramkrishnank commented 5 years ago

ERROR in node_modules/nativescript-background-http/index.d.ts(1,29): error TS2307: Cannot find module 'data/observable'.

Ramkrishnank commented 5 years ago

@tsonevn am getting below error while using nativescript-background-http

Can you help me to resolve this issue

ERROR in node_modules/nativescript-background-http/index.d.ts(1,29): error TS2307: Cannot find module 'data/observable'.

Executing webpack failed with exit code 2.

tns build android****

tsonevn commented 5 years ago

Hi @Ramkrishnank, Make sure that you are using the latest version of nativescript-background-http plugin. Also, for issues related to the nativescript-background-http plugin, please use nativescript-background-http repository.

Ramkrishnank commented 5 years ago

Hi @tsonevn

After migrate my project native-script to 6.1.2 application is not working it means "myapp has stopping " showing this error emulator