1
node client_soap.js 

node.js:249
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
Error: Cannot find module './http'
    at Function._resolveFilename (module.js:333:15)
    at Function._load (module.js:280:25)
    at Module.require (module.js:357:17)
    at require (module.js:373:17)
    at Object.<anonymous> (/home/a1/mysourc3e/client_soap.js:6:12)
    at Module._compile (module.js:444:26)
    at Object..js (module.js:462:10)
    at Module.load (module.js:351:32)
    at Function._load (module.js:309:12)
    at module.js:482:10

npm list
/home/a1/mysourc3e
└─┬ soap@0.1.3 
  ├── node-expat@1.5.0 
  └── request@2.2.6 

我正在尝试使用肥皂运行 node.js 的示例代码。我无法让https://github.com/milewise/node-soap/blob/master/lib/client.js工作。我从哪里获得模块?

4

1 回答 1

0

使用require('http')而不是require('./http').

HTTP 模块是内置在 node 中的,所以你不应该告诉加载器在当前目录中查找它(就像 " ./" 前缀所做的那样)。

于 2012-04-26T19:52:00.023 回答