首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >离子型:未能实例化模块ngCordova

离子型:未能实例化模块ngCordova
EN

Stack Overflow用户
提问于 2016-11-23 22:13:05
回答 1查看 1.6K关注 0票数 0

这是在安装地理定位插件和ngCordova之后遇到的错误:

代码语言:javascript
复制
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

我运行了以下命令:

代码语言:javascript
复制
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>

我把文件包括在文档里。我还将模块包含在代码中:

代码语言:javascript
复制
var app = angular.module('restaurant', ['ionic', 'ngCordova', 'firebase']);

ngCordova文件存在于此位置:

代码语言:javascript
复制
C:\Users\G\takeaway\www\lib\ngCordova\dist

这是我的密码:

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-11-23 23:46:40

我把这个修好了。必须将ngCordova目录复制到:

代码语言:javascript
复制
C:\Users\G\takeaway\platforms\android\assets\www\lib 
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40775006

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档