业力不能读取财产'原型'未定义的socket.io?

时间:2018-02-13 17:57:13

标签: javascript node.js karma-runner karma-jasmine

你只是想尝试做一个基本的业力设置

已关注here

但每当我尝试运行./node_modules/karma/bin/karma start

我明白了:

My-iMac:karma myname$ ./node_modules/karma/bin/karma start

/Applications/MAMP/htdocs/_Tutorials/AngularApps/_webpack/karma/node_modules/socket.io/lib/store.js:35
Store.prototype.__proto__ = EventEmitter.prototype;
                                         ^

TypeError: Cannot read property 'prototype' of undefined
    at Object.<anonymous> (/Applications/MAMP/htdocs/_Tutorials/AngularApps/_webpack/karma/node_modules/socket.io/lib/store.js:35:42)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Applications/AngularApps/_webpack/karma/node_modules/socket.io/lib/manager.js:16:13)
    at Module._compile (module.js:635:30)

想知道为什么它甚至在寻找socket.io ??

我的包json:

  "name": "karma-seed",
  "version": "1.0.0",
  "description": "",
  "scripts": {
    "test": "./node_modules/karma/bin/karma start karma.conf.js"
  },
  "devDependencies": {
    "jasmine-core": "^2.2.0",
    "karma": "^0.12.31",
    "karma-chrome-launcher": "^0.1.7",
    "karma-jasmine": "^0.3.5"
  }
}

节点版本:v8.9.1

Npm:5.6.0

我已在全球范围内安装了karma-cli

1 个答案:

答案 0 :(得分:0)

将业力版本更新为package.json - &#34;业力&#34;:&#34; ^ 2.0.0&#34;

或只是运行npm install karma --save-dev