2016-11-23 78 views
0

這是錯誤安裝的地理位置插件和ngCordova後,我得到:離子:無法實例化模塊ngCordova

E/AndroidProtocolHandler: Unable to open asset URL: file:///android_asset/www/lib/ngCordova/dist/ng-cordova.js 
D/JsMessageQueue: Set native->JS mode to OnlineEventsBridgeMode 
E/ConnectivityManager.CallbackHandler: callback not found for RELEASED message 
I/chromium: [INFO:CONSOLE(17922)] "Uncaught Error: [$injector:modulerr] Failed to instantiate module restaurant due to: 
      Error: [$injector:modulerr] Failed to instantiate module ngCordova due to: 
      Error: [$injector:nomod] Module 'ngCordova' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. 
      http://errors.angularjs.org/1.5.3/$injector/nomod?p0=ngCordova 

我已經運行下面的命令:

C:\Users\G\takeaway>ionic plugin add cordova-plugin-geolocation 
Fetching plugin "cordova-plugin-geolocation" via npm 
Installing "cordova-plugin-geolocation" for android 
Fetching plugin "cordova-plugin-compat" via npm 
Installing "cordova-plugin-compat" for android 

C:\Users\G\takeaway>bower install ngCordova 
bower      invalid-meta for:C:\Users\G\takeaway\bower.json 
bower      invalid-meta The "name" is recommended to be lowercase, can contain digits, dots, dashes 
bower ionic#1.3.2    cached https://github.com/driftyco/ionic-bower.git#1.3.2 
bower ionic#1.3.2    validate 1.3.2 against https://github.com/driftyco/ionic-bower.git#1.3.2 
bower ngCordova#*    cached https://github.com/driftyco/ng-cordova.git#0.1.27-alpha 
bower ngCordova#*    validate 0.1.27-alpha against https://github.com/driftyco/ng-cordova.git#* 
bower ionic#1.3.2    install ionic#1.3.2 
bower       skipped ionic was not installed because there is already a non-bower directory with that name in the components directory (www\lib\ionic). You can force installation with --force. 
ionic#1.3.2 ..\AppData\Local\bower\cache\packages\75785deacc09255f971c33542b04c50a\1.3.2 
├── angular#1.5.3 
├── angular-animate#1.5.3 
├── angular-sanitize#1.5.3 
└── angular-ui-router#0.2.13 

C:\Users\G\takeaway> 

我包括該文件按照文檔。我還包括模塊在我的代碼:

var app = angular.module('restaurant', ['ionic', 'ngCordova', 'firebase']); 

的ngCordova文件存在在此位置:

C:\Users\G\takeaway\www\lib\ngCordova\dist 

這裏是我的代碼:enter image description here

回答

1

我有了這個固定。必須將ngCordova目錄複製到:

C:\Users\G\takeaway\platforms\android\assets\www\lib 
相關問題