我正在尝试使用popular依赖注入库electrolyte,但即使是一个需要它的简单脚本也会抛出错误。我找不到任何与我的错误相关的讨论或issues,但由于我对node还不熟悉,所以在向作者求助之前,我想检查一下我是否做了明显错误的事情。
安装电解质:
npm install electrolyte使用以下节点运行此单行应用程序test.js:
var di = require("electrolyte");获取此错误:
util.js:555
ctor.prototype = Object.create(superCtor.prototype, {
^
TypeError: Object prototype may only be an Object or null
at Function.create (native)
at Object.exports.inherits (util.js:555:27)
at Object.<anonymous> (/home/vagrant/tmp/node_modules/electrolyte/lib/container.js:42:6)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/vagrant/tmp/node_modules/electrolyte/lib/index.js:1:79)我已经在两个环境( ubuntu上的node来自包,mac上的brew)中进行了尝试,结果是相同的。我可以安装并需要其他库,而不会出现问题。node和电解质的版本似乎是最新的。
发布于 2016-02-07 03:54:08
看起来我通过brew和debian包得到的node版本都很旧了。按照installation guide添加节点自己的debian存储库纠正了这个问题。
https://stackoverflow.com/questions/35214758
复制相似问题