I'm building a NativeScript app. For implementing Drawer, I'm trying to use 'Telerik NativeScript UI' plugin. But, something is not working after installing the plugin & my NativeScript build is getting failed.
Here are 2 screenshots of the build failed.
My package.json file content
{
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"readme": "NativeScript Application",
"repository": "<fill-your-repository-here>",
"nativescript": {
"id": "org.nativescript.testapp",
"tns-android": {
"version": "2.0.0"
}
},
"dependencies": {
"#angular/common": "2.0.0-rc.1",
"#angular/compiler": "2.0.0-rc.1",
"#angular/core": "2.0.0-rc.1",
"#angular/platform-browser": "2.0.0-rc.1",
"#angular/platform-browser-dynamic": "2.0.0-rc.1",
"#angular/platform-server": "2.0.0-rc.1",
"#angular/router-deprecated": "2.0.0-rc.1",
"nativescript-angular": "0.1.1",
"nativescript-telerik-ui": "^1.1.1",
"tns-core-modules": "^2.0.0"
},
"devDependencies": {
"babel-traverse": "6.9.0",
"babel-types": "6.10.2",
"babylon": "6.8.1",
"filewalker": "0.1.2",
"lazy": "1.0.11",
"nativescript-dev-typescript": "^0.3.2",
"typescript": "^1.8.10"
}
}
My NativeScript CLI version is 2.0.1
Any idea, what's probably going wrong ?
-------It's fixed-------
The solution is, after getting the error..
Don't remove the plugin
Remove the platform(android/ios)
Add the platform once again(android/ios)
Rebuild the app
Try
platform remove android
and then
platform add android
tns run android
I have had this issue every time I try to add a new plugin to nativescript (e.g the phone, telerik-UI, and contact plugins). What worked for me was just navigating into platform > android and then running gradlew clean. This way you wouldn't have to re-add the android platform every time you add a plugin.
Related
I just have installed Nativescript on my macOS Sierra 10.12.12. But when i enter the command: tns platfrom add ios I get the following error message:
*Version strings are not in the same format*
*#platform add*
When I enter the same command for Android everything works fine.
tns doctor gives me the following feedback:
*Your components are up-to-date.*
*No issues were detected.*
Log Trace:
ns platform add ios --log trace > log.txt
Error: Version strings are not in the same format
at Object.versionCompare (/usr/local/lib/node_modules/nativescript/lib/common/helpers.js:111:15)
at /usr/local/lib/node_modules/nativescript/lib/services/ios-project-service.js:92:25
at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
at FiberFuture.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
at /usr/local/lib/node_modules/nativescript/lib/services/platform-service.js:69:47
at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
at FiberFuture.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
at .each.platform (/usr/local/lib/nodemodules/nativescript/lib/services/platform-service.js:55:58)
at arrayEach (/usr/local/lib/node_modules/nativescript/node_modules/lodash/lodash.js:451:11)
at Function.forEach (/usr/local/lib/node_modules/nativescript/node_modules/lodash/lodash.js:8634:14)
#Brad Martin
This is my package.json file:
{
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"readme": "NativeScript Application",
"repository": "<fill-your-repository-here>",
"nativescript": {
"id": "org.nativescript.HelloWorld",
"nativescript-teststudio-variables": {
"IOS_APP_URL": "telerikmt1"
},
"tns-android": {
"version": "2.5.0"
}
},
"dependencies": {
"#angular/common": "2.4.3",
"#angular/compiler": "2.4.3",
"#angular/core": "2.4.3",
"#angular/forms": "2.4.3",
"#angular/http": "2.4.3",
"#angular/platform-browser": "2.4.3",
"#angular/platform-browser-dynamic": "2.4.3",
"#angular/router": "3.4.3",
"nativescript-angular": "1.4.0",
"nativescript-teststudio": "^1.1.4",
"nativescript-theme-core": "~1.0.2",
"reflect-metadata": "~0.1.8",
"rxjs": "~5.0.1",
"tns-core-modules": "^2.5.1"
},
"devDependencies": {
"babel-traverse": "6.23.1",
"babel-types": "6.23.0",
"babylon": "6.16.1",
"lazy": "1.0.11",
"nativescript-dev-android-snapshot": "^0.*.*",
"nativescript-dev-typescript": "^0.3.5",
"typescript": "~2.1.0",
"zone.js": "~0.7.2"
}
}
I'm trying to use the Parse push plugin with my Ionic 2 app from: https://github.com/taivo/parse-push-plugin.
Once downloaded it says that it's ready to use anywhere in my code with the ParsePushPlugin name space. When I try to use it without importing it throws the error:
Cannot find name 'ParsePushPlugin'.
Upon doing either of the following in the terminal:
cordova plugin add https://github.com/taivo/parse-push-plugin
OR
ionic plugin add https://github.com/taivo/parse-push-plugin
The result is deposited in my 'plugins' directory. This is not part of Ionic native so I can't just import from Ionic Native. I have also tried importing it from the plugins directory using the ParsePushPlugin name space both with and without curly brackets but that does not working either. Where am I going wrong?
UPDATE
I updated my package.json based on an inquiry and as of this package.json along with a full re-start the app still says that cordova is not defined.
{
"name": "ionic-hello-world",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"#angular/common": "2.1.1",
"#angular/compiler": "2.1.1",
"#angular/compiler-cli": "2.1.1",
"#angular/core": "2.1.1",
"#angular/forms": "2.1.1",
"#angular/http": "2.1.1",
"#angular/platform-browser": "2.1.1",
"#angular/platform-browser-dynamic": "2.1.1",
"#angular/platform-server": "2.1.1",
"#ionic/storage": "1.1.6",
"#types/parse": "^1.2.32",
"ionic-angular": "2.0.0-rc.3",
"ionic-native": "2.2.3",
"ionicons": "3.0.0",
"rxjs": "5.0.0-beta.12",
"underscore": "^1.8.3",
"moment": "2.10.3",
"sweetalert": "1.1.3",
"zone.js": "0.6.26"
},
"devDependencies": {
"#ionic/app-scripts": "0.0.45",
"typescript": "2.0.6"
},
"cordovaPlugins": [
"cordova-plugin-device",
"cordova-plugin-console",
"cordova-plugin-whitelist",
"cordova-plugin-splashscreen",
"cordova-plugin-statusbar",
"ionic-plugin-keyboard",
"cordova-plugin-facebook4",
"cordova-plugin-nativestorage",
"parse-push-plugin"
],
"cordovaPlatforms": [
"ios",
{
"platform": "ios",
"version": "",
"locator": "ios"
}
],
"description": "CPM: An Ionic project"
}
set
declare var cordova:any;
and use like this:
platform.ready().then(
() => {
console.log("MyApp::constructor platform.ready");
cordova.plugins.ParsePushPlugin.// settings and methods.
}
);
Check this answer
Note: Cordova plugins do not work with ionic serve as they are not loaded to the browser. You will need to test in a phone.
To be 100% clear. In order to use the Taivo Parse Push Plugin library with Ionic2/Angular2:
1) Download the library from github.
git clone https://github.com/taivo/parse-push-plugin
2) You do not import this library like you do things from ionic/native or node_module libraries. In any component that you would like to use it simply do this below your imports in the given ts file:
declare var ParsePushPlugin: any;
From here you are ready to go and ParsePushPlugin has all of the capabilities outlined in the docs.
I am using Ionic 2 RC1. I want to know how to include source maps for every .ts file that is transpiled into main.js file and include their mappings in main.js.map.
Somehow when trying to debug the app loaded into an iPad connected to my Mac from Safari, I don't see .map file being loaded/visible in the network tab or resource tab. I turned on Web Inspector on my iPad.
How do I troubleshoot source map missbehaviour and what can I do to make it available in Safari, Chrome and other browsers.
Thanks,
Rad
Update 1:
I am using these npm packages:
"dependencies": {
"#angular/common": "2.0.0",
"#angular/compiler": "2.0.0",
"#angular/compiler-cli": "0.6.2",
"#angular/core": "2.0.0",
"#angular/forms": "2.0.0",
"#angular/http": "2.0.0",
"#angular/platform-browser": "2.0.0",
"#angular/platform-browser-dynamic": "2.0.0",
"#angular/platform-server": "2.0.0",
"#ionic/storage": "1.1.6",
"ionic-angular": "2.0.0-rc.1",
"ionic-native": "2.2.3",
"ionicons": "3.0.0",
"rxjs": "5.0.0-beta.12",
"zone.js": "0.6.21"
},
"devDependencies": {
"#ionic/app-scripts": "^0.0.36",
"typescript": "^2.0.3"
},
you should use "#ionic/app-scripts": "0.0.36" in your dependencies packages.json file - this should do the work .
Recently I've updated my NativeScript CLI to 2.1.0 & installed Telerik UI plugin. After that. my app build getting fail with the error "actual and formal argument lists differ in length".
Screenshot -
package.json
{
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"readme": "NativeScript Application",
"repository": "<fill-your-repository-here>",
"nativescript": {
"id": "org.nativescript.bhramaan",
"tns-android": {
"version": "2.1.1"
}
},
"dependencies": {
"#angular/common": "2.0.0-rc.1",
"#angular/compiler": "2.0.0-rc.1",
"#angular/core": "2.0.0-rc.1",
"#angular/http": "2.0.0-rc.1",
"#angular/platform-browser": "2.0.0-rc.1",
"#angular/platform-browser-dynamic": "2.0.0-rc.1",
"#angular/platform-server": "2.0.0-rc.1",
"#angular/router-deprecated": "2.0.0-rc.1",
"nativescript-angular": "0.1.1",
"nativescript-plugin-firebase": "^3.0.1",
"tns-core-modules": "^2.0.0"
},
"devDependencies": {
"babel-traverse": "6.9.0",
"babel-types": "6.9.0",
"babylon": "6.8.0",
"filewalker": "0.1.2",
"lazy": "1.0.11",
"nativescript-dev-typescript": "^0.3.2",
"typescript": "^1.8.10"
}
}
I've also removed platform & added once again. But, still now no luck.
Here is your problem:
"tns-android": {
"version": "2.1.1"
}
"tns-core-modules": "^2.0.0"
You must have TNS/NativeScript-CLI, TNS-Common-Core and the TNS-Platforms the same version.
Type: tns info to easily see what versions you are.
Here are the upgrade steps:
To upgrade NativeScript command line
npm install -g nativescript#latest
To Upgrade the NativeScript Common Core library
npm install tns-core-modules#latest --save
To Upgrade the platform (replace android with ios for iOS)
tns platform remove android
tns platform add android
I am trying to build a Angular2 application using TypeScript in Visual Studio. I followed the steps shown in "5 min Quickstart" in angular2 site.(https://angular.io/guide/quickstart). But I got the following error as shown in following picture
Can anyone Help me to fix the issue "Cannot find name 'Map'? thanks a advanced
the package.json file definition is as follows
{
"name": "angular2-quickstart",
"version": "1.0.0",
"scripts": {
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
"lite": "lite-server",
"postinstall": "typings install",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings"
},
"license": "ISC",
"dependencies": {
"#angular/common": "2.0.0-rc.2",
"#angular/compiler": "2.0.0-rc.2",
"#angular/core": "2.0.0-rc.2",
"#angular/http": "2.0.0-rc.2",
"#angular/platform-browser": "2.0.0-rc.2",
"#angular/platform-browser-dynamic": "2.0.0-rc.2",
"#angular/router": "2.0.0-rc.2",
"#angular/router-deprecated": "2.0.0-rc.2",
"#angular/upgrade": "2.0.0-rc.2",
"systemjs": "0.19.27",
"core-js": "^2.4.0",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"zone.js": "^0.6.12",
"angular2-in-memory-web-api": "0.0.12",
"bootstrap": "^3.3.6"
},
"devDependencies": {
"concurrently": "^2.0.0",
"lite-server": "^2.2.0",
"typescript": "^1.8.10",
"typings":"^1.0.4"
}
}
I had to change VS file as documented here typescriptServices.js
Invalid module name in augmentation #8518
I see the issue now. this is a duplicate of #7415, and should be fixed
in the next release (see #7507).
As work arounds for now, you can replace C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TypeScript\typescriptServices.js
with the file in
https://raw.githubusercontent.com/Microsoft/TypeScript/Fix8518/lib/typescriptServices.js.
First take a local backup though.
This is related to VS 2015, but somewhere below should be also some solution for VS 2013
After googling a lot at last i found the solution and i want to share it with all of you
just add the following line at the top of component .ts file
///<reference path="../node_modules/angular2/typings/browser.d.ts"/>
just see the picture below
Update
if you use anguler2 beta(angular2/core) then you should add
///<reference path="../node_modules/angular2/typings/browser.d.ts"/>
but if you use angular2 rc1/rc2/rc3(#angular2/core) the you should add
/// <reference path="../node_modules/typescript/lib/lib.es6.d.ts" />
To fix this issue you open your typings.d.ts and comment the below lines
Comment out the below code, it will fix your problem.
//declare var module: {
// id: string;
//};