繁体   English   中英

调试node.js应用程序时,chrome dev工具“保存”不起作用

[英]chrome dev tools “save” not working while debugging node.js app

在chrome dev工具中调试node.js cli脚本时(可能是http://youtu.be/03qGA-GJXjI ),我无法保存我在运行时所做的更改,就像我从网站调试普通的javascript一样。 我收到一条错误消息:

“Debugger.setScriptSource失败.LiveEdit失败:无法编译新版本的脚本:SyntaxError:意外的令牌[”

然后警告:

通过配置禁用将实时编辑更改保存回源文件。 更改config.json中的选项“saveLiveEdit”以启用此功能。

有谁知道如何解决这一问题? 在不离开chrome dev工具的情况下调试和编辑文件并保存它会非常方便。

谢谢。

顺便说一句,这就是config.json的样子, https://github.com/node-inspector/node-inspector/blob/master/config.json 我尝试将“saveLiveEdit”选项更改为true,但仍然收到相同的消息“通过配置禁用将实时编辑更改保存回源文件。在config.json中更改选项”saveLiveEdit“以启用此功能。”

这似乎对我有用。 我开始2炮弹:

  1. node-inspector --save-live-edit
  2. node --debug app.js

然后在浏览器中访问http://127.0.0.1:8080/?ws=127.0.0.1:8080&port=5858

更改代码应将其保存在硬盘驱动器上。

您可以使用环境变量node-inspector_save-live-edit并将其设置为true node-inspector_器扫描环境变量node-inspector_前缀。

您还可以使用$ HOME / .node-inspectorrc并存储以下内容:

{ "save-live-edit": true, "preload": false, "hidden": ["node_modules/" ], "nodejs": ["--harmony"] }

不要修改config.json ,而是更改$ YOUR_NPM_PATH \\ node_modules \\ node- \\ lib \\ config.js。 在文件中查找和修改:

'save-live-edit': {
    ...
    ...
    default: true
  },

启动node-debug时,请使用选项--save-live-edit

例如:

node-debug --save-live-edit app.js

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM