2017-04-20 86 views
3

我試圖連接離子2應用backand並獲得此運行時錯誤:運行時錯誤:無法找到模塊「離子天然的」

Cannot find module "ionic-native".

我曾嘗試運行npm install @ionic-native/core --save - 但沒有幫助。非常感謝

Set Up Details Are Here: Ionic Framework: 3.0.1 Ionic App Scripts: 1.3.0 Angular Core: 4.0.0 Angular Compiler CLI: 4.0.0 Node: 6.10.1 OS Platform: Windows 10 Navigator Platform: Win32 User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36

Error: Cannot find module "ionic-native" at g (localhost:8100/build/polyfills.js:3:7133) at Object.module.exports (localhost:8100/build/main.js:114616:7) at webpack_require (localhost:8100/build/main.js:20:30) at Object. (localhost:8100/build/main.js:86362:73) at webpack_require (localhost:8100/build/main.js:20:30) at Object. (localhost:8100/build/main.js:140153:70) at webpack_require (localhost:8100/build/main.js:20:30) at localhost:8100/build/main.js:66:18

如下:

{ 
    "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

我不知道你需要看到什麼,但任何幫助表示讚賞 –

+0

你可以顯示你的'package.json'文件嗎?永遠不要在評論部分提出您的問題。請刪除它,並將其與您的原始文章。 – Sampath

+0

嗨,它不會讓我把它全部粘貼在原來的評論中,因爲它顯然有鏈接。相當新使用stackoverflow。我如何獲得package.json文件?我意識到這可能是一個菜鳥問題 –

回答

0

具有離子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

所以,你需要升級你的代碼,如果你想使用任何的天然特徵。

+0

謝謝,那麼我需要升級到離子3?我認爲我現在使用的是版本2.2.1 –

+0

看起來你已經在v3上了。確保您已遵循鏈接中提到的升級說明。 –

相關問題