我可以向 NPM 添加调试脚本吗? [英] Can I add a debug script to NPM?

查看:33
本文介绍了我可以向 NPM 添加调试脚本吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经编辑了我的 package.json 来自定义开始"脚本,因此它将 --debug 标志添加到节点:

I have edited my package.json to customize the "start" script so it adds the --debug flag to node:

  "scripts": {
    "start": "node --debug server.js"
  }

有没有办法添加新脚本,例如调试脚本,它可以执行我现在自定义的开始"正在执行的操作?

Is there a way of adding new scripts for example a debug script that would do what my customized "start" is doing right now?

我希望能够执行:

npm debug

推荐答案

在你的 package.json 中定义脚本

In your package.json define the script

"scripts": {
  "debug": "node --inspect server.js"
}

然后你可以使用 npm 的运行脚本

And then you can use npm's run-script

npm run-script debug

或更短的版本

npm run debug

这篇关于我可以向 NPM 添加调试脚本吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆