嗨,只是想做一个基本的 karma 设置
已关注 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"
}
}
Node 版本:v8.9.1
净下午:5.6.0
我已经在全局安装了 karma-cli
最佳答案
将 karma 版本更新为 package.json - "karma": "^2.0.0"
或者简单地运行 npm install karma --save-dev
关于javascript - Karma 无法读取未定义 socket.io 的属性 'prototype'?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/48772836/