So I'm trying to run the VSCode debugger run my express program, but I noticed that it's messing up the relative directory paths.
When using a module like JIMP
, a Node image manipulator, when I run the app from the Powershell, I need to enter the path relative to the project root (where the package.JSON
is) to find the image. But when I run it from the VSCode debugger, I get an error, because it is finding the image relative to my app
directory, which is a folder in my project root.
Is there a configuration I can edit to fix this?
launch.json
:
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: /?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "npm start",
"program": "${workspaceRoot}/app/app.js"
}
]
}
jsconfig.js
:
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"allowSyntheticDefaultImports": true
},
"exclude": [
"node_modules"
]
}
Thanks in advance
So I'm trying to run the VSCode debugger run my express program, but I noticed that it's messing up the relative directory paths.
When using a module like JIMP
, a Node image manipulator, when I run the app from the Powershell, I need to enter the path relative to the project root (where the package.JSON
is) to find the image. But when I run it from the VSCode debugger, I get an error, because it is finding the image relative to my app
directory, which is a folder in my project root.
Is there a configuration I can edit to fix this?
launch.json
:
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "npm start",
"program": "${workspaceRoot}/app/app.js"
}
]
}
jsconfig.js
:
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"allowSyntheticDefaultImports": true
},
"exclude": [
"node_modules"
]
}
Thanks in advance
Share Improve this question edited Mar 25, 2017 at 17:51 Owen M asked Mar 25, 2017 at 16:41 Owen MOwen M 2,7643 gold badges20 silver badges39 bronze badges1 Answer
Reset to default 18Solved it:
You need to include "cwd": "${workspaceRoot}"
in your launch.json