【问题标题】:IntelliJ IDEA Node-Webkit debug is not workingIntelliJ IDEA Node-Webkit 调试不工作
【发布时间】:2014-10-07 13:53:21
【问题描述】:

我正在 IDEA 上设置 node-webkit 并发现调试问题 - 断点不起作用。

这是我的代码:

index.html

<!DOCTYPE html>
<html>
<body onload="process.mainModule.exports.callback0()">
<script>
    var sup = require('./sup.js')
    document.write(sup.hi())
</script>
</body>
</html>

package.json

{
    "main": "index.html",
    "name": "Test",
    "version": "0.0.0",
    "node-main": "node-main.js"
}

sup.js

module.exports = {
    hi: function() {
        return 'hi'; //breakpoint here don't work
    }
}

node-main.js

var i = 0;
exports.callback0 = function () {
    console.log(i + ": " + window.location); //breakpoint here don't work
}

控制台输出

0: file:///C:/%5CWork%5Cwebkit%5Cwebkitbase/index.html

HTML 输出

这意味着所有执行的脚本和问题都在 IDEA 调试中。可能是什么原因?

【问题讨论】:

    标签: javascript node.js intellij-idea node-webkit


    【解决方案1】:

    似乎是 IDEA 中的一个错误。

    检查了 IDEA 13.1.5 和 WebStorm 8.0.4。

    两者都有这个问题。

    在 IDEA/WebStorm 中还有许多其他尚未支持 Node-WebKit 的症状:

    1) debugger 语句有效,但仅适用于 sup 模块(不适用于节点主脚本)。

    2) index.html 调试有效,但行号不匹配。

    3) 从 index.html 进入 sup.js 是可行的,但它需要某种生成的代码,如下所示:

    (function (exports, require, module, __filename, __dirname) { 
        module.exports = {
            hi: function() {
                return 'hi'
            }
        }
    });
    

    在 IDEA/WebStorm bugtracker 中有一些关于这个问题的活动,但从其强度来看,可能需要等待几个月,然后再考虑认真使用 IDEA node-webkit 集成。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-29
      • 2023-02-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-07
      • 2012-05-05
      • 2019-11-28
      相关资源
      最近更新 更多