SpookyJS:添加了一些依赖项后.js无法执行hello



我从github克隆了一个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)的主要开发者回答我:

听起来该包(网页)与本机冲突 幻影JS模块网页.您将无法将它们一起使用。

我认为您将无法使用名为 word 的包。你可以 创建另一个 npm 包,以不同的名称包装它。

最新更新