Nodejs:如何解决模块上的Windows兼容性问题?

时间:2015-09-28 08:46:51

标签: javascript node.js npm node-modules

我正在使用nodejs编写命令行工具。 Windows报告错误。在Linux和Mac OSX系统上没有问题。

https://www.npmjs.com/package/idoc

全球安装npm install idoc -g。运行idoc init命令。您可以重现此错误。依赖项inquirer错误。

错误消息

C:\Documents and Settings\Administrator\Application Data\npm\node_modules\idoc\node_modules\inquirer\node_modules\rx-lite\rx.lite.js:549
    throw e;
    ^

TypeError: Cannot read property 'substring' of undefined
    at Interface.rl._getCursorPos (C:\Documents and Settings\Administrator\Application Data\npm\node_modules\idoc\node_modules\inquirer\                                               node_modules\readline2\index.js:55:51)
    at ScreenManager.render (C:\Documents and Settings\Administrator\Application Data\npm\node_modules\idoc\node_modules\inquirer\lib\ut                                               ils\screen-manager.js:19:27)
    at Prompt.render (C:\Documents and Settings\Administrator\Application Data\npm\node_modules\idoc\node_modules\inquirer\lib\prompts\i                                               nput.js:75:15)
    at Prompt._run (C:\Documents and Settings\Administrator\Application Data\npm\node_modules\idoc\node_modules\inquirer\lib\prompts\inp                                               ut.js:49:8)
    at Prompt.run (C:\Documents and Settings\Administrator\Application Data\npm\node_modules\idoc\node_modules\inquirer\lib\prompts\base                                               .js:57:8)
    at Object.<anonymous> (C:\Documents and Settings\Administrator\Application Data\npm\node_modules\idoc\node_modules\inquirer\lib\ui\p                                               rompt.js:83:12)
    at module.exports (C:\Documents and Settings\Administrator\Application Data\npm\node_modules\idoc\node_modules\inquirer\node_modules                                               \run-async\index.js:15:21)
    at C:\Documents and Settings\Administrator\Application Data\npm\node_modules\idoc\node_modules\inquirer\lib\utils\utils.js:16:7
    at tryCatcher (C:\Documents and Settings\Administrator\Application Data\npm\node_modules\idoc\node_modules\inquirer\node_modules\rx-                                               lite\rx.lite.js:537:29)
    at setDisposable (C:\Documents and Settings\Administrator\Application Data\npm\node_modules\idoc\node_modules\inquirer\node_modules\                                               rx-lite\rx.lite.js:5380:36)

1 个答案:

答案 0 :(得分:1)

为了使用Chrome浏览器调试器轻松调试,您可以使用node-inspector

请按照上述链接中的说明进行操作。