I have tried to update a project to 3.0.0 version but noticed that the tns-android won't update to 3.0.0. I created a new hello world project (JS, TS & angular) but the platform only installs in 2.5.0. Also, when I try to run the TS or ng project, it shows this:
Executing before-prepare hook from C:\Users\Edcs9\Documents\NativeScript\test3ts\hooks\before-prepare\nativescrip
t-dev-android-snapshot.js
Executing before-prepare hook from C:\Users\Edcs9\Documents\NativeScript\test3ts\hooks\before-prepare\nativescrip
t-dev-typescript.js
Found peer TypeScript 2.1.6
app/app.ts(8,22): error TS2307: Cannot find module 'application'.
app/main-page.ts(7,27): error TS2307: Cannot find module 'data/observable'.
app/main-page.ts(8,22): error TS2307: Cannot find module 'ui/page'.
app/main-view-model.ts(1,26): error TS2307: Cannot find module 'data/observable'.
app/main-view-model.ts(23,18): error TS2339: Property 'notifyPropertyChange' does not exist on type 'HelloWorldMo
del'.
node_modules/tns-core-modules/tns-core-modules.d.ts(14,18): error TS2304: Cannot find name 'Promise'.
node_modules/tns-core-modules/tns-core-modules.d.ts(17,27): error TS2304: Cannot find name 'Headers'.
node_modules/tns-core-modules/tns-core-modules.d.ts(19,44): error TS2304: Cannot find name 'RequestInit'.
node_modules/tns-core-modules/tns-core-modules.d.ts(19,58): error TS2304: Cannot find name 'Promise'.
TypeScript compiler failed with exit code 1
Any help?
Thanks in advance
JavaScript
{
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"readme": "NativeScript Application",
"repository": "<fill-your-repository-here>",
"nativescript": {
"id": "org.nativescript.test3",
"tns-android": {
"version": "2.5.0"
}
},
"dependencies": {
"nativescript-theme-core": "~1.0.2",
"tns-core-modules": "3.0.0"
},
"devDependencies": {
"babel-traverse": "6.4.5",
"babel-types": "6.4.5",
"babylon": "6.4.5",
"lazy": "1.0.11",
"nativescript-dev-android-snapshot": "^0.*.*"
}
}
Angular
{
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"readme": "NativeScript Application",
"repository": "<fill-your-repository-here>",
"nativescript": {
"id": "org.nativescript.test3ng",
"tns-android": {
"version": "2.5.0"
}
},
"dependencies": {
"@angular/animations": "~4.0.0",
"@angular/common": "~4.0.0",
"@angular/compiler": "~4.0.0",
"@angular/core": "~4.0.0",
"@angular/forms": "~4.0.0",
"@angular/http": "~4.0.0",
"@angular/platform-browser": "~4.0.0",
"@angular/platform-browser-dynamic": "~4.0.0",
"@angular/router": "~4.0.0",
"nativescript-angular": "~1.5.1",
"nativescript-theme-core": "~1.0.2",
"reflect-metadata": "~0.1.8",
"rxjs": "~5.2.0",
"tns-core-modules": "3.0.0",
"zone.js": "~0.8.2"
},
"devDependencies": {
"babel-traverse": "6.4.5",
"babel-types": "6.4.5",
"babylon": "6.4.5",
"lazy": "1.0.11",
"nativescript-dev-android-snapshot": "^0.*.*",
"nativescript-dev-typescript": "~0.3.5",
"typescript": "~2.1.0"
}
}
TypeScript
{
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"readme": "NativeScript Application",
"repository": "<fill-your-repository-here>",
"nativescript": {
"id": "org.nativescript.test3ts",
"tns-android": {
"version": "2.5.0"
}
},
"dependencies": {
"nativescript-theme-core": "~1.0.2",
"tns-core-modules": "3.0.0"
},
"devDependencies": {
"babel-traverse": "6.4.5",
"babel-types": "6.4.5",
"babylon": "6.4.5",
"lazy": "1.0.11",
"nativescript-dev-android-snapshot": "^0.*.*",
"nativescript-dev-typescript": "~0.3.5",
"typescript": "~2.1.0"
}
}
Hi @emmanuel128,
Make sure that you have installed latest CLI. You could check that by running tns --version. If there is a different version that 3.0, you could upgrade the CLI with npm install nativescript --g.
Then try to create new project with tns create MyApp and to build it tns run android.
If you already upgraded the CLI you could try the following steps and to add tns-android menually.
tns platform remove androidtns platform add androidtns run androidIt worked for JavaScript, but with angular it shows this:
Executing before-prepare hook from C:\Users\Edcs9\Documents\NativeScript\test3ng\hooks\before-prepare\nativescrip
t-dev-android-snapshot.js
Executing before-prepare hook from C:\Users\Edcs9\Documents\NativeScript\test3ng\hooks\before-prepare\nativescrip
t-dev-typescript.js
Found peer TypeScript 2.1.6
node_modules/@angular/common/src/directives/ng_class.d.ts(48,34): error TS2304: Cannot find name 'Set'.
node_modules/@angular/common/src/location/platform_location.d.ts(51,59): error TS2304: Cannot find name 'Promise'
.
node_modules/@angular/common/src/pipes/async_pipe.d.ts(45,23): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/aot/compiler.d.ts(37,38): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/aot/compiler.d.ts(48,32): error TS2304: Cannot find name 'Map'.
node_modules/@angular/compiler/src/aot/compiler_host.d.ts(25,33): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/compile_metadata.d.ts(369,20): error TS2304: Cannot find name 'Set'.
node_modules/@angular/compiler/src/compile_metadata.d.ts(371,28): error TS2304: Cannot find name 'Set'.
node_modules/@angular/compiler/src/compile_metadata.d.ts(373,15): error TS2304: Cannot find name 'Set'.
node_modules/@angular/compiler/src/compile_metadata.d.ts(375,23): error TS2304: Cannot find name 'Set'.
node_modules/@angular/compiler/src/compile_metadata.d.ts(377,17): error TS2304: Cannot find name 'Set'.
node_modules/@angular/compiler/src/compile_metadata.d.ts(379,25): error TS2304: Cannot find name 'Set'.
node_modules/@angular/compiler/src/directive_normalizer.d.ts(39,72): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/directive_normalizer.d.ts(41,74): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/i18n/extractor.d.ts(14,33): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/i18n/extractor.d.ts(22,35): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/jit/compiler.d.ts(41,49): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/jit/compiler.d.ts(43,65): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/metadata_resolver.d.ts(67,104): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/output/output_ast.d.ts(444,63): error TS2304: Cannot find name 'Set'.
node_modules/@angular/compiler/src/resource_loader.d.ts(13,23): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/util.d.ts(32,18): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/util.d.ts(33,46): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/core/src/application_init.d.ts(17,27): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/core/src/application_ref.d.ts(116,76): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/core/src/application_ref.d.ts(132,110): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/core/src/application_ref.d.ts(162,67): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/core/src/application_ref.d.ts(164,101): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/core/src/change_detection/differs/default_keyvalue_differ.d.ts(24,16): error TS2304: Cannot
find name 'Map'.
node_modules/@angular/core/src/change_detection/differs/default_keyvalue_differ.d.ts(32,16): error TS2304: Cannot
find name 'Map'.
node_modules/@angular/core/src/change_detection/differs/keyvalue_differs.d.ts(23,18): error TS2304: Cannot find n
ame 'Map'.
node_modules/@angular/core/src/di/reflective_provider.d.ts(87,123): error TS2304: Cannot find name 'Map'.
node_modules/@angular/core/src/di/reflective_provider.d.ts(87,165): error TS2304: Cannot find name 'Map'.
node_modules/@angular/core/src/linker/compiler.d.ts(43,49): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/core/src/linker/compiler.d.ts(51,65): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/core/src/linker/ng_module_factory_loader.d.ts(14,34): error TS2304: Cannot find name 'Promi
se'.
node_modules/@angular/core/src/linker/system_js_ng_module_factory_loader.d.ts(28,25): error TS2304: Cannot find n
ame 'Promise'.
node_modules/@angular/core/src/util/lang.d.ts(12,53): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(79,33): error TS2304: Cannot find name 'M
ap'.
node_modules/@angular/platform-browser/src/dom/dom_adapter.d.ts(97,42): error TS2304: Cannot find name 'Map'.
node_modules/@angular/platform-browser/src/dom/shared_styles_host.d.ts(11,30): error TS2304: Cannot find name 'Se
t'.
node_modules/@angular/platform-browser/src/dom/shared_styles_host.d.ts(22,30): error TS2304: Cannot find name 'Se
t'.
node_modules/@angular/router/src/config.d.ts(310,85): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/router/src/interfaces.d.ts(78,99): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/router/src/interfaces.d.ts(157,109): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/router/src/interfaces.d.ts(229,162): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/router/src/interfaces.d.ts(299,89): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/router/src/interfaces.d.ts(367,50): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/router/src/router.d.ts(285,70): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/router/src/router.d.ts(307,59): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/router/src/router_module.d.ts(186,23): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/router/src/utils/collection.d.ts(28,79): error TS2304: Cannot find name 'Promise'.
node_modules/nativescript-angular/dom-adapter.d.ts(79,34): error TS2304: Cannot find name 'Map'.
node_modules/nativescript-angular/platform-common.d.ts(32,67): error TS2304: Cannot find name 'Promise'.
node_modules/nativescript-angular/platform-common.d.ts(33,101): error TS2304: Cannot find name 'Promise'.
node_modules/nativescript-angular/platform-providers.d.ts(1,23): error TS2307: Cannot find module 'ui/frame'.
node_modules/nativescript-angular/platform-providers.d.ts(2,22): error TS2307: Cannot find module 'ui/page'.
node_modules/nativescript-angular/platform-providers.d.ts(4,24): error TS2307: Cannot find module 'platform'.
node_modules/nativescript-angular/resource-loader.d.ts(4,23): error TS2304: Cannot find name 'Promise'.
node_modules/nativescript-angular/router.d.ts(3,23): error TS2307: Cannot find module 'ui/frame'.
node_modules/nativescript-angular/router/ns-location-strategy.d.ts(2,45): error TS2307: Cannot find module 'ui/fr
ame'.
node_modules/nativescript-angular/router/ns-module-factory-loader.d.ts(7,25): error TS2304: Cannot find name 'Pro
mise'.
node_modules/nativescript-angular/router/page-router-outlet.d.ts(3,24): error TS2307: Cannot find module 'platfor
m'.
node_modules/nativescript-angular/router/page-router-outlet.d.ts(4,23): error TS2307: Cannot find module 'ui/fram
e'.
node_modules/nativescript-angular/router/router-extensions.d.ts(3,23): error TS2307: Cannot find module 'ui/frame
'.
node_modules/nativescript-angular/router/router-extensions.d.ts(10,67): error TS2304: Cannot find name 'Promise'.
node_modules/nativescript-angular/router/router-extensions.d.ts(11,72): error TS2304: Cannot find name 'Promise'.
node_modules/rxjs/Observable.d.ts(69,60): error TS2304: Cannot find name 'Promise'.
node_modules/rxjs/Observable.d.ts(69,70): error TS2304: Cannot find name 'Promise'.
node_modules/tns-core-modules/tns-core-modules.d.ts(14,18): error TS2304: Cannot find name 'Promise'.
node_modules/tns-core-modules/tns-core-modules.d.ts(17,27): error TS2304: Cannot find name 'Headers'.
node_modules/tns-core-modules/tns-core-modules.d.ts(19,44): error TS2304: Cannot find name 'RequestInit'.
node_modules/tns-core-modules/tns-core-modules.d.ts(19,58): error TS2304: Cannot find name 'Promise'.
TypeScript compiler failed with exit code 1
Nevermind, I updated the angular dependencies and worked perfect
{
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"readme": "NativeScript Application",
"repository": "<fill-your-repository-here>",
"nativescript": {
"id": "org.nativescript.test3ng",
"tns-android": {
"version": "3.0.0"
}
},
"dependencies": {
"@angular/animations": "~4.1.0",
"@angular/common": "~4.1.0",
"@angular/compiler": "~4.1.0",
"@angular/core": "~4.1.0",
"@angular/forms": "~4.1.0",
"@angular/http": "~4.1.0",
"@angular/platform-browser": "~4.1.0",
"@angular/router": "~4.1.0",
"nativescript-angular": "~3.0.0",
"nativescript-theme-core": "~1.0.2",
"reflect-metadata": "~0.1.8",
"rxjs": "~5.3.0",
"tns-core-modules": "~3.0.0",
"zone.js": "~0.8.2"
},
"devDependencies": {
"babel-traverse": "6.4.5",
"babel-types": "6.4.5",
"babylon": "6.4.5",
"lazy": "1.0.11",
"nativescript-dev-typescript": "~0.4.0",
"typescript": "~2.2.1"
}
}
Another thing I've seen is you may need to update your tsconfig.json; I had a similar issue and found it's an issue with typescript after update See this link
TypeScript projects need to reference the ES6 and DOM libraries. Add this to your tsconfig.json:
``` json
{
"compilerOptions": {
"lib": ["es6", "dom"],
"baseUrl": ".",
"paths": {
"": [
"./node_modules/tns-core-modules/",
"./node_modules/*"]
}
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
Another thing I've seen is you may need to update your tsconfig.json; I had a similar issue and found it's an issue with typescript after update See this link
TypeScript
TypeScript projects need to reference the ES6 and DOM libraries. Add this to your tsconfig.json:
``` json
{
"compilerOptions": {
"lib": ["es6", "dom"],
"baseUrl": ".",
"paths": {
"": [
"./node_modules/tns-core-modules/",
"./node_modules/*"]
}