【问题标题】:How to run npm script in visual studio code launch.json file如何在 Visual Studio 代码 launch.json 文件中运行 npm 脚本
【发布时间】:2017-06-23 16:19:33
【问题描述】:

我正在尝试在 Visual Studio 代码的 launch.json 文件中运行以下 npm 脚本:

nodemon src/shim-host/index.js --exec babel-node --babel-preset-es2015

到目前为止,我在launch.json 文件中的尝试:

"program": "nodemon src/shim-host/index.js --exec babel-node --babel-preset-es2015",

但是,我收到错误 "Attribute 'program' is not absolute'"

有人可以帮忙吗?

提前致谢!

【问题讨论】:

    标签: javascript node.js npm visual-studio-code


    【解决方案1】:

    program 属性是你的代码,nodemon 应该是 runtimeExecutable。

    来自Visual Studio Code documentation的示例:

    {
        "name": "Launch server.js via nodemon",
        "type": "node",
        "request": "launch",
        "cwd": "${workspaceRoot}",
        "runtimeExecutable": "nodemon",
        "runtimeArgs": [
            "--debug=5858"
        ],
        "program": "${workspaceRoot}/server.js",
        "restart": true,
        "port": 5858,
        "console": "integratedTerminal",
        "internalConsoleOptions": "neverOpen"
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-02-23
      • 2018-10-27
      • 2020-03-28
      • 1970-01-01
      相关资源
      最近更新 更多