vscode配置node路径和执行命令
·
"terminal.integrated.env.windows": {
"CHCP": "65001",
"PATH": "${env:PATH};C:\\Windows\\System32;D:\\soft"
},
...
"code-runner.executorMap": {
// 3. JS 运行前切换编码,解决乱码
"javascript": "node $fullFileName",
}
...
D:\\sof:这里配置node所在的目录"javascript": "node $fullFileName",: 这里会自动识别node.exe"CHCP": "65001",: 这里配置utf-8,解决中文输出乱码
整体json:
{
"editor.wordWrap": "on",
"editor.rename.enablePreview": false,
"editor.mouseWheelZoom": true,
"terminal.integrated.persistentSessionScrollback": 1000,
"security.workspace.trust.untrustedFiles": "open",
// 1. 终端环境:补全 Node 路径 + 强制 UTF-8 编码
"terminal.integrated.env.windows": {
"CHCP": "65001",
"PATH": "${env:PATH};C:\\Windows\\System32;D:\\soft"
},
// 2. 优先用 CMD 终端(避免 PowerShell 兼容问题)
"terminal.integrated.defaultProfile.windows": "Command Prompt",
"git.autofetch": true,
"git.enableSmartCommit": true,
"files.autoGuessEncoding": true,
"code-runner.executorMap": {
// 3. JS 运行前切换编码,解决乱码
"javascript": "node $fullFileName",
"java": "cd $dir && javac $fileName && java $fileNameWithoutExt",
"c": "cd $dir && gcc $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"zig": "zig run",
"cpp": "cd $dir && g++ $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"objective-c": "cd $dir && gcc -framework Cocoa $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"php": "php",
"python": "cmd /c chcp 65001 >nul && python -u",
"perl": "perl",
"perl6": "perl6",
"ruby": "ruby",
"go": "go run",
"lua": "lua",
"groovy": "groovy",
"powershell": "powershell -ExecutionPolicy ByPass -File",
"bat": "cmd /c",
"shellscript": "bash",
"fsharp": "fsi",
"csharp": "scriptcs",
"vbscript": "cscript //Nologo",
"typescript": "ts-node",
"coffeescript": "coffee",
"scala": "scala",
"swift": "swift",
"julia": "julia",
"crystal": "crystal",
"ocaml": "ocaml",
"r": "Rscript",
"applescript": "osascript",
"clojure": "lein exec",
"haxe": "haxe --cwd $dirWithoutTrailingSlash --run $fileNameWithoutExt",
"rust": "cd $dir && rustc $fileName && $dir$fileNameWithoutExt",
"racket": "racket",
"scheme": "csi -script",
"ahk": "autohotkey",
"autoit": "autoit3",
"dart": "dart",
"pascal": "cd $dir && fpc $fileName && $dir$fileNameWithoutExt",
"d": "cd $dir && dmd $fileName && $dir$fileNameWithoutExt",
"haskell": "runghc",
"nim": "nim compile --verbosity:0 --hints:off --run",
"lisp": "sbcl --script",
"kit": "kitc --run",
"v": "v run",
"sass": "sass --style expanded",
"scss": "scss --style expanded",
"less": "cd $dir && lessc $fileName $fileNameWithoutExt.css",
"FortranFreeForm": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"fortran-modern": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"fortran_fixed-form": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"fortran": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"sml": "cd $dir && sml $fileName",
"mojo": "mojo run",
"erlang": "escript",
"spwn": "spwn build",
"pkl": "cd $dir && pkl eval -f yaml $fileName -o $fileNameWithoutExt.yaml",
"gleam": "gleam run -m $fileNameWithoutExt"
},
// 4. 强制 Run Code 在终端运行,确保编码生效
"code-runner.runInTerminal": true,
"code-runner.encoding": "utf8",
"debug.javascript.defaultRuntimeExecutable": {
"pwa-node": "node"
},
"eslint.nodeEnv": ""
}
更多推荐


所有评论(0)