Linux用のWindowsSubsytemを使用してNodeアプリケーションをデバッグしようとしていますが、パスが変換されていないと思います。
これは私のlaunch.jsonです
{
// Use IntelliSense to learn about possible 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": "Launch NestJS",
"useWSL": true,
"console": "integratedTerminal",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run-script",
"start:dev"
],
"port": 5000,
}
]
}
これは、デバッグを試みた後にコンソールに表示されるものです。
isiah@isiah-acer:/mnt/c/Users/Isiah/Documents/Programming_Projects/etc/podcast_db/new-api$ cd "c:\Users\Isiah\Documents\Programming_Projects\etc\podcast_db\new-api" ; "C:\WINDOWS\System32\bash.exe" -ic "npm run-script start:dev"
-bash: cd: c:\Users\Isiah\Documents\Programming_Projects\etc\podcast_db\new-api: No such file or directory
C:\WINDOWS\System32\bash.exe: command not found
さらに詳しい情報については、 npm run-script start:dev
はnodemon
を実行し、これが私のnodemon.jsonです。
{
"watch": [
"src"
],
"ext": "ts",
"ignore": [
"src/**/*.spec.ts"
],
"exec": "node -r tsconfig-paths/register --inspect=5000 --require ts-node/register src/main.ts"
}
この問題は、すべての拡張機能が無効になっている場合に発生しますか?:はい
これは、まだサポートされていない複雑なセットアップです。
これは、起動構成から"console": "integratedTerminal"
を削除するときに機能するはずです。 "useWSL": true
で十分です。
このようなセットアップをデバッグするために、拡張機能WSL WorkspaceFolderを使用し、次をlauch構成に追加します。
"localRoot": "${workspaceFolder}",
"remoteRoot": "${command:extension.vscode-wsl-workspaceFolder}",
私のために働く例:
{
"type": "node",
"request": "launch",
"name": "Run NPM script in WSL",
"useWSL": true,
"localRoot": "${workspaceFolder}",
"remoteRoot": "${command:extension.vscode-wsl-workspaceFolder}",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run-script",
"foo",
],
"internalConsoleOptions": "openOnSessionStart",
"skipFiles": [
"<node_internals>/**/*.js",
],
},
モカテストをデバッグするには、次の起動構成を使用します。
{
"type": "node",
"request": "launch",
"name": "Run mocha tests in WSL",
"useWSL": true,
"localRoot": "${workspaceFolder}",
"remoteRoot": "${command:extension.vscode-wsl-workspaceFolder}",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"-u",
"tdd",
"--timeout",
"999999",
"--colors",
"--exit",
"${command:extension.vscode-wsl-workspaceFolder}/tests/test.js"
],
"internalConsoleOptions": "openOnSessionStart",
"skipFiles": [
"<node_internals>/**/*.js",
],
},
注:出力は[デバッグコンソール]タブに表示されます。
@ n0v1私のために働いた。 ありがとうございました!
これは現在、WSLで開発する一般的な使用例であり、デバッグを機能させることが私の作業にとって重要です。 Pythonを機能させるために🤞
VS Codeを使用したリモート開発を発表しました。詳細については、ブログ投稿をご覧くださいhttps://code.visualstudio.com/blogs/2019/05/02/remote-development
最も参考になるコメント
これは、起動構成から
"console": "integratedTerminal"
を削除するときに機能するはずです。"useWSL": true
で十分です。このようなセットアップをデバッグするために、拡張機能WSL WorkspaceFolderを使用し、次をlauch構成に追加します。
私のために働く例:
モカテストをデバッグするには、次の起動構成を使用します。
注:出力は[デバッグコンソール]タブに表示されます。