Can't run Karma with Angular 1.4.9 with error angular.module(…).info is not a function

限于喜欢 提交于 2020-01-25 23:22:53

问题


When running karma start --single-run

there is an error

 Chrome 62.0.3202 (Linux 0.0.0) ERROR
  Uncaught TypeError: angular.module(...).info is not a function
  at /home/ali/bedopedia/client/node_modules/angular-mocks/angular-mocks.js:80

When I opened anguler-mocks.js there is a function called info and it need angular 1.6 .info({ angularVersion: '1.6.6' })

here is package.json file

"devDependencies": {
    "angular-mocks": "^1.6.0",
    "grunt": "^0.4.5",
    "grunt-jsmeter": "^0.3.1",
    "jasmine-core": "^2.5.2",
    "karma": "^0.13.22",
    "karma-chrome-launcher": "^0.2.3",
    "karma-jasmine": "^0.3.8",
    "karma-spec-reporter": "0.0.26",
    "load-grunt-tasks": "^3.5.0"
  }

回答1:


I solved it by making angular-mocks version the same version of angular I am using.

make it "angular-mocks": "1.4.9", in package.json file



来源:https://stackoverflow.com/questions/47200345/cant-run-karma-with-angular-1-4-9-with-error-angular-module-info-is-not-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!