Angular JS Unit Testing:搜索模块错误

时间:2016-11-24 15:29:59

标签: javascript angularjs unit-testing karma-jasmine

在package.json文件中,我有以下依赖项:

"devDependencies": {
    "bower": "^1.7.7",
    "http-server": "^0.9.0",
    "jasmine-core": "^2.4.1",
    "karma": "^0.13.22",
    "karma-chrome-launcher": "^0.2.3",
    "karma-firefox-launcher": "^0.1.7",
    "karma-jasmine": "^0.3.8",
    "karma-junit-reporter": "^0.4.1",
    "protractor": "^4.0.9"
  }

bower.json依赖项:

"dependencies": {
    "angular": "~1.5.0",
    "angular-route": "~1.5.0",
    "angular-loader": "~1.5.0",
    "angular-mocks": "~1.5.0",
    "html5-boilerplate": "^5.3.0"
  }

如果我执行命令karma start karma.conf.js,我将会出现如下错误:

     Error: Cannot find module 'jasmine-core'
        at Function.Module._resolveFilename (module.js:469:15)
        at Function.resolve (internal/module.js:27:19)
        at initJasmine (C:\Users\Ema_Holub\AppData\Roaming\npm\node_modules\karma-jasmine\lib\index.js:8:42)
        at Array.invoke (C:\Users\Ema_Holub\AppData\Roaming\npm\node_modules\karma\node_modules\di\lib\injector.js:75:15)
        at Injector.get (C:\Users\Ema_Holub\AppData\Roaming\npm\node_modules\karma\node_modules\di\lib\injector.js:48:43)
        at C:\Users\Ema_Holub\AppData\Roaming\npm\node_modules\karma\lib\server.js:143:20
        at Array.forEach (native)
        at Server._start (C:\Users\Ema_Holub\AppData\Roaming\npm\node_modules\karma\lib\server.js:142:21)
        at Injector.invoke (C:\Users\Ema_Holub\AppData\Roaming\npm\node_modules\karma\node_modules\di\lib\injector.js:75:15)
        at Server.start (C:\Users\Ema_Holub\AppData\Roaming\npm\node_modules\karma\lib\server.js:103:18)
        at Object.exports.run (C:\Users\Ema_Holub\AppData\Roaming\npm\node_modules\karma\lib\cli.js:280:26)
        at Object.<anonymous> (C:\Users\Ema_Holub\AppData\Roaming\npm\node_modules\karma\bin\karma:3:23)
        at Module._compile (module.js:570:32)
        at Object.Module._extensions..js (module.js:579:10)
        at Module.load (module.js:487:32)
        at tryModuleLoad (module.js:446:12)

我做错了什么?

0 个答案:

没有答案