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

After latest update, "command 'PickProcess' not found" error when using nodemon in the terminal #48333

Closed
ogrotten opened this issue Apr 22, 2018 · 8 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Milestone

Comments

@ogrotten
Copy link

Version 1.23.0-insider
Commit c1cd437
Date 2018-04-20T05:17:25.189Z
Shell 2.0.0-beta.7
Renderer 61.0.3163.100
Node 8.9.3
Windows 10 x64

I've been using the results of this guide successfully for "a while"
Node.js debugging in VS Code with Nodemon

TL;DR, that guide sets up a terminal running nodemon, with node console output, in VSC.

After the most recent update, restarts by nodemon fail to restart the inspector, and therefore giving an error message:
image

launch.json

{
	"version": "0.2.0",
	"configurations": [
		{
			"type": "node",
			"request": "attach",
			"name": "Node: Nodemon",
			"processId": "${command:PickProcess}",
			"restart": true,
			"protocol": "inspector",
		}
	]
}
@weinand weinand added debug Debug viewlet, configurations, breakpoints, adapter issues bug Issue identified by VS Code Team member as probable bug labels Apr 22, 2018
@microsoft microsoft deleted a comment from vscodebot bot Apr 22, 2018
@weinand weinand added this to the April 2018 milestone Apr 22, 2018
@weinand
Copy link
Contributor

weinand commented Apr 22, 2018

@isidorn This regression was introduced by the fix for #47021.

Analysis:

  • in the launch config from above the ${command:PickProcess} is evaluated (and the processId attributes is removed) by the node-debug extension. So the variable is not resolved by VS Code itself. VS Code only sees a "port" attribute instead.
  • On restart VS Code Stable sees the same config and everything works fine.
  • In the latest Insiders the fix for Questionable check for launch.json from file events #47021 makes VS Code re-read the original launch config before each restart (even if it hasn't changed). This re-read config has again the "processId" attribute which is resolved again. Since the debug type has changed from "node" to "node2" in between and since "node2" defines no variable "PickProcess", the error alert is shown (which is the correct behaviour).

I've reverted commit e2a123a to fix this regression.

@weinand
Copy link
Contributor

weinand commented Apr 22, 2018

@ogrotten BTW, instead of always having to select the correct process to attach to, you can use this - IMO simpler - launch config:

{
	"type": "node",
	"request": "launch",
	"name": "Node: Nodemon",
	"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/nodemon",
	"program": "${workspaceRoot}/test.js",
	"restart": true,
	"console": "integratedTerminal",
	"internalConsoleOptions": "neverOpen"
}

This configuration launches nodemon in debug mode in the integrated terminal and connects the debugger in one go.

This works in the latest Insiders.

@ogrotten
Copy link
Author

@weinand thanks for the fix and the config tip.

@ogrotten
Copy link
Author

@weinand Am I correct to assume that the next insiders release will fix this?

@weinand
Copy link
Contributor

weinand commented Apr 24, 2018

This is already fixed in the current Insiders.

@ogrotten
Copy link
Author

Thank you.

@ogrotten
Copy link
Author

ogrotten commented Apr 24, 2018

@weinand in the config you suggested, it errors with

Attribute 'runtimeExecutable' does not exist
('F:\path\to\projectdir/node_modules/.bin/nodemon').

Yes it switches slashes.

Nodemon is installed globally. Is there a global equivalent for ${workspaceRoot}?

[edit] After finding the docs for the vsc vars, I see that there's no global, probably because I conflated my local Node global with VSC globals.

Solution: Install nodemon local to the project. Not ideal, but it's dev anyway, so it'll prob be fine.

Thanks!

@weinand
Copy link
Contributor

weinand commented Apr 24, 2018

try:

{
	"type": "node",
	"request": "launch",
	"name": "Node: Nodemon",
	"runtimeExecutable": "nodemon",
	"program": "${workspaceRoot}/test.js",
	"restart": true,
	"console": "integratedTerminal",
	"internalConsoleOptions": "neverOpen"
}

@roblourens roblourens added the verified Verification succeeded label Apr 27, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Jun 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants