【发布时间】:2023-03-08 04:25:01
【问题描述】:
我已经安装了 Code Runner,并在 Executer Map 上进行了以下设置
{
"explorer.confirmDelete": false,
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
},
"[javascript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"liveServer.settings.donotShowInfoMsg": true,
"window.zoomLevel": 0,
"code-runner.executorMap": {
"javascript": "/home/pabc/.nvm/versions/node/v13.13.0/bin/node",
"php": "C:\\php\\php.exe",
"python": "python",
"perl": "perl",
"ruby": "C:\\Ruby23-x64\\bin\\ruby.exe",
"go": "go run",
"html": "\"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\"",
"java": "cd $dir && javac $fileName && java $fileNameWithoutExt",
"c": "cd $dir && gcc $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt"
}
}
运行Console.log(10)时输出如下
[Running] /home/pabc/.nvm/versions/node/v13.13.0/bin/node "/home/pabc/CODE_PROJECTS/Odin_Project/randomCode/test.js"
[Done] exited with code=0 in 0.025 seconds
为了得到一些输出,我还需要验证什么吗?
【问题讨论】:
-
/home/pabc/.nvm/versions/node/v13.13.0/bin/node "/home/pabc/CODE_PROJECTS/Odin_Project/randomCode/test.js"粘贴到常规 shell 中会产生什么? -
返回以下
Error: Cannot find module '/home/pabc/CODE_PROJECTS/Odin_Project/randomCode/test.js' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:952:15) at Function.Module._load (internal/modules/cjs/loader.js:835:27) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) at internal/main/run_main_module.js:17:47 { code: 'MODULE_NOT_FOUND', requireStack: [] } -
那么您的问题与 Code Runner 或 Visual Studio Code 没有任何关系。
/home/pabc/.nvm/versions/node/v13.13.0/bin/node -v打印什么? -
打印
v13.13.0 -
您的系统中有当前可用的 Node 版本,并且工作正常。但是您在
test.js中的代码不正确。但是,您仍然应该在 VSCode 中看到错误消息——我认为这甚至是不可配置的。
标签: javascript node.js npm visual-studio-code vscode-code-runner