Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test launch option that allows run node project by npm script #12253

Closed
1 task done
weinand opened this issue Sep 19, 2016 · 3 comments
Closed
1 task done

Test launch option that allows run node project by npm script #12253

weinand opened this issue Sep 19, 2016 · 3 comments

Comments

@weinand
Copy link
Contributor

weinand commented Sep 19, 2016

Test for #2726:

Complexity 2

A frequent feature request was to support running 'npm' scripts directly from a launch configuration.
This has now become possible by the following small tweaks of existing launch configuration concepts:

  • Any program available on the PATH (e.g. 'npm', 'mocha', 'gulp', etc.) can now be used for the runtimeExecutable attribute and arguments can be passed via the runtimeArgs.
  • The program attribute is no longer mandatory which helps if the npm script already specifies the program to launch.
  • If you specify a debug port via the port attribute, the --debug-brk=nnnn attribute will no longer be automatically added because the debug port is typically specified by the npm scripts as well.

So if your package.json has a 'debug' script, e.g.:

  "scripts": {
    "debug": "node --nolazy --debug-brk=5858 myProgram.js"
  },

the corresponding launch config could look like this:

{
    "name": "Launch via NPM",
    "type": "node",
    "request": "launch",
    "cwd": "${workspaceRoot}",
    "runtimeExecutable": "npm",
    "runtimeArgs": [
        "run-script", "debug"
    ],
    "port": 5858
}

Verify that you can start a debug session by using your favourite tool/scripts in a 'node' launch config.

@weinand weinand added this to the September 2016 milestone Sep 19, 2016
@weinand weinand self-assigned this Sep 19, 2016
@weinand weinand removed their assignment Sep 19, 2016
@dbaeumer dbaeumer removed their assignment Sep 27, 2016
@Alanz2223
Copy link

@weinand I am trying to configure the editor with your options, but the 'program' attribute seems to still be a requirement since I am receiving the error : Attribute 'program' is missing or empty.. I am using version 1.5.3 and node 5.10.0

@basickarl
Copy link

@Alanz2223 Afaiac this is scheduled for the 1.6.0 release (#11917). So you'll just have a to wait a little bit until it's released :)

@weinand
Copy link
Contributor Author

weinand commented Oct 10, 2016

@Alanz2223 alternatively you can try the Insider release to try this.

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants