[英]Can't get Azure to work with Ionic2/Angular2/Cordova app
I am using the base Ionic2 Blank app. 我正在使用基本的Ionic2 Blank应用程序。 When I instantiate Azure with the following line in home.ts
当我在home.ts中使用以下行实例化Azure时
import azureMobileClient from 'azure-mobile-apps-client';
, it deploys without an error. ,它会正确部署。 The failure is just a blank screen on Ripple or a blank screen on the device.
失败仅仅是Ripple上的黑屏或设备上的黑屏。 I do not see any errors on build.
我没有看到任何构建错误。
Current setup: Win10 x64 Visual Studio 2015 Community Cordova CLI: 6.3.1 Ionic Framework version: 2.0.0-rc.1 Ionic CLI Version: 2.1.1 Ionic App Lib Version: 2.1.1 Node Version: v4.6.0 当前设置:Win10 x64 Visual Studio 2015社区Cordova CLI:6.3.1 Ionic Framework版本:2.0.0-rc.1 Ionic CLI版本:2.1.1 Ionic App Lib版本:2.1.1节点版本:v4.6.0
Here are the steps I took 这是我采取的步骤
Package.json 的package.json
{
"name": "io.cordova.myapp3e6a78",
"private": true,
"version": "0.0.1",
"description": "ionic2-ts-blank: An Ionic project",
"dependencies": {
"@angular/common": "2.0.0-rc.3",
"@angular/compiler": "2.0.0-rc.3",
"@angular/core": "2.0.0-rc.3",
"@angular/platform-browser": "2.0.0-rc.3",
"@angular/platform-browser-dynamic": "2.0.0-rc.3",
"@angular/http": "2.0.0-rc.3",
"es6-shim": "^0.35.0",
"ionic-angular": "2.0.0-beta.10",
"ionic-native": "1.2.4",
"ionicons": "3.0.0",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"zone.js": "^0.6.12",
"azure-mobile-apps-client": "^2.0.0-rc1"
},
"devDependencies": {
"del": "2.2.0",
"gulp": "3.9.1",
"gulp-watch": "4.3.5",
"ionic-gulp-browserify-typescript": "2.0.0",
"ionic-gulp-fonts-copy": "^1.0.0",
"ionic-gulp-html-copy": "^1.0.0",
"ionic-gulp-sass-build": "^1.0.0",
"ionic-gulp-scripts-copy": "^2.0.0",
"run-sequence": "1.1.5",
"typings": "^1.3.1"
},
"cordovaPlugins": [
"cordova-plugin-whitelist",
"cordova-plugin-console",
"cordova-plugin-statusbar",
"cordova-plugin-device",
"cordova-plugin-splashscreen",
"ionic-plugin-keyboard"
],
"cordovaPlatforms": [ ],
"scripts": {
"build": "node_modules/.bin/gulp build",
"typings": "node_modules/.bin/typings install",
"postinstall": "npm run typings && npm run build"
}
}
declarations.d.ts declare module 'azure-mobile-apps-client';
Declarations.d.ts
declare module 'azure-mobile-apps-client';
home.ts home.ts
import {Component} from '@angular/core';
import {NavController} from 'ionic-angular';
import azureMobileClient from 'azure-mobile-apps-client';
@Component({
templateUrl: 'build/pages/home/home.html'
})
export class HomePage {
constructor(private navController: NavController) {
}
onLink(url: string) {
window.open(url);
}
}
You aren't actually using azureMobileClient in your code, aside from bringing it in. The ENOENT means it didn't get downloaded. 除了将其引入之外,您实际上并没有在代码中使用azureMobileClient。ENOENT表示未下载它。 You need a successful npm install before you can use it.
您需要成功安装npm才能使用它。 You then actually need to use it.
然后,您实际上需要使用它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.