我正在尝试将离子2应用程序连接到后端并获得此运行时错误:
找不到模块“ionic-native”。
我尝试过运行npm install @ionic-native/core --save
- 但没有帮助。非常感谢
设置详细信息:Ionic Framework:3.0.1 Ionic App脚本: 1.3.0 Angular Core:4.0.0 Angular Compiler CLI:4.0.0节点:6.10.1 OS平台:Windows 10 Navigator平台:Win32用户代理:Mozilla / 5.0 (Windows NT 10.0; Win64; x64)AppleWebKit / 537.36(KHTML,与Gecko一样) Chrome / 57.0.2987.133 Safari / 537.36
错误:在g处找不到模块“ionic-native” (localhost:8100 / build / polyfills.js:3:7133)在Object.module.exports (localhost:8100 / build / main.js:114616:7)在webpack_require (localhost:8100 / build / main.js:20:30)在Object。 (localhost:8100 / build / main.js:86362:73)在webpack_require (localhost:8100 / build / main.js:20:30)在Object。 (localhost:8100 / build / main.js:140153:70)在webpack_require (localhost:8100 / build / main.js:20:30)at 本地主机:8100 /构建/ main.js:66:18
Package.Json
如下:
{
"name": "ionic-hello-world",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"ionic:build": "ionic-app-scripts build",
"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/core": "3.4.2",
"@ionic-native/splash-screen": "3.4.2",
"@ionic-native/status-bar": "3.4.2",
"@ionic/storage": "2.0.1",
"ionic-angular": "3.0.1",
"ionicons": "3.0.0",
"rxjs": "5.1.1",
"socket.io-client": "^1.7.3",
"sw-toolbox": "3.4.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@ionic/app-scripts": "1.3.0",
"@types/node": "7.0.13",
"@types/socket.io-client": "1.4.29",
"typescript": "~2.2.1"
},
"cordovaPlugins": [
"cordova-plugin-whitelist",
"cordova-plugin-statusbar",
"cordova-plugin-console",
"cordova-plugin-device",
"cordova-plugin-splashscreen",
"ionic-plugin-keyboard",
"cordova-plugin-inappbrowser"
],
"cordovaPlatforms": [],
"description": "myApp: An Ionic project"
}
答案 0 :(得分:1)
此问题与旧导入'ionic-native'
相关联在我的情况下: 从'ionic-native'导入{StatusBar,Splashscreen}; 我删除并添加了新的:
https://ionicframework.com/docs/native/status-bar https://ionicframework.com/docs/native/splash-screen
如果您也是这种情况,请不要忘记在模块提供程序中添加
答案 1 :(得分:0)
使用Ionic 3,离子原生模块现在作为提供者加载。见以下链接:
https://github.com/driftyco/ionic/blob/master/CHANGELOG.md
http://blog.ionic.io/ionic-native-3-x/
https://github.com/driftyco/ionic-conference-app/commit/62088
因此,如果要使用任何本机功能,则必须升级代码。