简体   繁体   中英

Karma Cannot read property 'prototype' of undefined socket.io?

Hi just trying to do a basic karma setup

Have followed here

but whenever I try to run ./node_modules/karma/bin/karma start

I get:

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)

Wondering why it's even looking for socket.io??

my package 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"
  }
}

Node version: v8.9.1

Npm : 5.6.0

I've installed karma-cli globally

Update the karma version to package.json - "karma": "^2.0.0"

or simply run npm install karma --save-dev

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM