I'am new to angular and running into a problem. I used the yeoman angular generator and added the ngAnimate module. When I run grunt test I get the following error:

我是个新角色并遇到问题。我使用了yeoman角度生成器并添加了ngAnimate模块。当我运行grunt测试时,我收到以下错误:

Error: [$injector:modulerr] Failed to instantiate module portfolioApp due to:
Error: [$injector:modulerr] Failed to instantiate module ngAnimate due to:
Error: [$injector:nomod] Module 'ngAnimate' 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.

app.js

app.js

'use strict';

angular.module('portfolioApp', [
   'ngAnimate',
   'ngCookies',
   'ngResource',
   'ngSanitize',
   'ngRoute'
])

index.html

的index.html

<script src="bower_components/jquery/jquery.js"></script>
<script src="bower_components/angular/angular.js"></script>

    <!-- build:js scripts/modules.js -->
    <script src="bower_components/angular-animate/angular-animate.js"></script>
    <script src="bower_components/angular-resource/angular-resource.js"></script>
    <script src="bower_components/angular-cookies/angular-cookies.js"></script>
    <script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
    <script src="bower_components/angular-route/angular-route.js"></script>

bower.json

bower.json

{
  "name": "portfolio",
  "version": "0.0.0",
  "dependencies": {
    "angular": "1.2.0",
    "json3": "~3.2.4",
    "es5-shim": "~2.1.0",
    "jquery": "~1.10.2",
    "greensock": "~1.11.2",
    "angular-animate": "1.2.0",
    "angular-resource": "1.2.0",
    "angular-cookies": "1.2.0",
    "angular-sanitize": "1.2.0",
    "angular-route": "1.2.0"
  },
  "devDependencies": {
    "angular-mocks": "1.2.0",
    "angular-scenario": "1.2.0"
  }
}

I think the module should be loaded and i can't figure out what i'am doing wrong. Does anyone have suggestions?

我认为该模块应该加载,我无法弄清楚我做错了什么。有没有人有建议?

Thanks

谢谢

1 个解决方案

#1


31

I suspect the reason is: If you run grunt test, the karma task will run. The configuration for karma is in the karma.conf.js file. There you must add angular-animate.js in the files array.

我怀疑原因是:如果你运行grunt测试,karma任务将运行。 karma的配置位于karma.conf.js文件中。你必须在files数组中添加angular-animate.js。

更多相关文章

  1. 不使用chokidar更新所需的节点/快速模块?
  2. JavaScript中可见性检查的测试条件
  3. 如何测试一个点是否是二次Bézier曲线的一部分?
  4. chai-as-promised:单个测试中的多个期望语句
  5. 如何测试潜在的“浏览器崩溃”JavaScript?
  6. How to learn js properly(week4)使用js建立的动态测试网页
  7. 在多个文件中需要相同的模块
  8. 是否可以从节点js中的同一模块导出构造函数和一些正常函数?
  9. Node.js无法找到模块'tcp'

随机推荐

  1. MySQL Cluster在线添加数据节点
  2. Windows安装MySQL Community 5.7.17(非msi
  3. 如何在SQL server中创建excel表并导出
  4. 数据库问题java.sql.SQLException: Colum
  5. Django学习之mysql增删改查
  6. 解决mysql sum求和返回null问题或IFNULL
  7. mysql 忽略主键冲突、避免重复插入的几种
  8. 快被Tomcat连接Mysql连接池问题弄疯了!
  9. sqlmap遇到url重写的示例
  10. 已有SQLSERVER表如何生成其代码?