我正在尝试将facebook登录整合到我的ionic 2应用程序中。我一直在遵循here指南,一切都很好,直到我开始在构造函数中使用Auth和User。
问题是,当前当我在构造函数中使用public auth: Auth, public user: User
时,它给予问题。
未捕获的错误:找不到模块“ionic-native”
下面是我的完整代码
import { Component } from '@angular/core';
import { Auth, User } from '@ionic/cloud-angular';
@Component({
selector: 'social-auth',
templateUrl: 'social.html',
})
export class SocialAuth {
constructor(public auth: Auth, public user: User) {
}
openTwitter(){
this.auth.login('twitter').then((data) => {
console.log(data);
});
}
}
我的包json是
{
"name": "ionic-app-base",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build --rollup ./config/rollup.config.js",
"minify": "ionic-app-scripts minify --cleancss ./config/cleancss.config.js",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"@angular/common": "4.0.0",
"@angular/compiler": "4.0.0",
"@angular/compiler-cli": "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",
"@ionic-native/camera": "^3.10.3",
"@ionic-native/core": "^3.6.1",
"@ionic-native/device": "^3.6.1",
"@ionic-native/file": "^3.6.1",
"@ionic-native/file-path": "^3.6.1",
"@ionic-native/geolocation": "^3.6.1",
"@ionic-native/in-app-browser": "^3.12.1",
"@ionic-native/paypal": "^3.10.2",
"@ionic-native/sim": "^3.5.0",
"@ionic-native/social-sharing": "^3.10.3",
"@ionic-native/splash-screen": "3.4.2",
"@ionic-native/status-bar": "3.4.2",
"@ionic-native/toast": "^3.6.1",
"@ionic-native/transfer": "^3.6.1",
"@ionic/cloud-angular": "^0.12.0",
"@ionic/storage": "2.0.1",
"ionic-angular": "3.0.1",
"ionic-debug-console": "^0.1.0",
"ionic-native": "^3.5.0",
"ionicons": "3.0.0",
"moment": "^2.18.1",
"rxjs": "5.1.1",
"sw-toolbox": "3.4.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@ionic/app-scripts": "1.3.0",
"@ionic/cli-plugin-ionic-angular": "1.1.2",
"typescript": "~2.2.1"
}
}
当我安装离子clound,然后这是我得到:-
1条答案
按热度按时间ia2d9nvy1#
您的package.json中有无效的套件。
从3.x版本开始,
ionic-native
被拆分为@ionic-native/core
和@ionic-native/package_name
。因此ionic-native 3.x
不存在。从package.json中删除
"ionic-native": "^3.5.0",
条目。清除node_modules文件夹并运行
npm install
也正如我的评论中提到的:您 * 不 * 需要再次将Auth设置为提供商..它将由云模块处理