SpookyJS:添加一些依赖项后无法执行 hello.js
SpookyJS: failed to execute hello.js after adding some dependencies
我 git 从 git 中心克隆一个 spookyjs
到我的 shell,然后 npm install
和 运行 node examples/hello.js
.
一切顺利,hello.js
输出:
Hello, from Spooky the Tuff Little Ghost - Wikipedia, the free encyclopedia
然后我添加一些依赖到 package.json:
来自
"dependencies": {
"underscore": "1.3.x",
"async": "0.1.x",
"tiny-jsonrpc": "0.2.x",
"carrier": "0.1.x",
"duplexer": "0.0.x",
"readable-stream": "~1.0.2"
}
至
"dependencies": {
"underscore": "1.3.x",
"async": "0.1.x",
"tiny-jsonrpc": "0.2.x",
"carrier": "0.1.x",
"duplexer": "0.0.x",
"readable-stream": "~1.0.2",
"express": "^4.13.4",
"bluebird": "^3.3.4",
"body-parser": "~1.13.2",
"consul": "^0.23.0",
"cookie-parser": "~1.3.5",
"debug": "~2.2.0",
"express": "~4.13.1",
"jade": "~1.11.0",
"morgan": "~1.6.1",
"native-dns": "^0.7.0",
"node-phantom": "^0.2.5",
"serve-favicon": "~2.3.0",
"util": "^0.10.3",
"webpage": "^0.3.0"
}
然后我npm install
,然后运行又是node examples/hello.js
。但现在它因奇怪的日志而失败:
{ id: 1,
code: -32603,
message: 'undefined is not a constructor (evaluating \'require(\'webpage\').create()\')' }
{ id: 2, code: -32603, message: 'Type error' }
{ id: 3, code: -32603, message: 'Type error' }
我的问题是,为什么在SpookyJS
中添加一些依赖会导致这样的错误,如何避免这个错误?
将该问题发布到 github。 SpookyJS(lawnsea)的主要开发者回答我:
Sounds like that package (webpage) is conflicting with the native
PhantomJS module webpage. You will not be able to use those together.
I don't think you'll be able to use a package named webpage. You could
create another npm package that wraps it under a different name.
我 git 从 git 中心克隆一个 spookyjs
到我的 shell,然后 npm install
和 运行 node examples/hello.js
.
一切顺利,hello.js
输出:
Hello, from Spooky the Tuff Little Ghost - Wikipedia, the free encyclopedia
然后我添加一些依赖到 package.json:
来自
"dependencies": {
"underscore": "1.3.x",
"async": "0.1.x",
"tiny-jsonrpc": "0.2.x",
"carrier": "0.1.x",
"duplexer": "0.0.x",
"readable-stream": "~1.0.2"
}
至
"dependencies": {
"underscore": "1.3.x",
"async": "0.1.x",
"tiny-jsonrpc": "0.2.x",
"carrier": "0.1.x",
"duplexer": "0.0.x",
"readable-stream": "~1.0.2",
"express": "^4.13.4",
"bluebird": "^3.3.4",
"body-parser": "~1.13.2",
"consul": "^0.23.0",
"cookie-parser": "~1.3.5",
"debug": "~2.2.0",
"express": "~4.13.1",
"jade": "~1.11.0",
"morgan": "~1.6.1",
"native-dns": "^0.7.0",
"node-phantom": "^0.2.5",
"serve-favicon": "~2.3.0",
"util": "^0.10.3",
"webpage": "^0.3.0"
}
然后我npm install
,然后运行又是node examples/hello.js
。但现在它因奇怪的日志而失败:
{ id: 1,
code: -32603,
message: 'undefined is not a constructor (evaluating \'require(\'webpage\').create()\')' }
{ id: 2, code: -32603, message: 'Type error' }
{ id: 3, code: -32603, message: 'Type error' }
我的问题是,为什么在SpookyJS
中添加一些依赖会导致这样的错误,如何避免这个错误?
将该问题发布到 github。 SpookyJS(lawnsea)的主要开发者回答我:
Sounds like that package (webpage) is conflicting with the native PhantomJS module webpage. You will not be able to use those together.
I don't think you'll be able to use a package named webpage. You could create another npm package that wraps it under a different name.