0

I have installed Code Runner and i have made the following setup on the 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"
    }
}

When running Console.log(10) the output is as follow

[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

Is there anything else i need to verify in order to get some output?

  • What does `/home/pabc/.nvm/versions/node/v13.13.0/bin/node "/home/pabc/CODE_PROJECTS/Odin_Project/randomCode/test.js"` produce when pasted into a regular shell? – Álvaro González Apr 19 '20 at 11:24
  • Returns the following ```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: [] } ``` – Paulo Brás Apr 19 '20 at 11:28
  • Then your problem doesn't have anything to do with Code Runner or Visual Studio Code. What does `/home/pabc/.nvm/versions/node/v13.13.0/bin/node -v` print? – Álvaro González Apr 19 '20 at 11:30
  • prints ```v13.13.0``` – Paulo Brás Apr 19 '20 at 11:34
  • You have current version of Node available in your system and it's working fine. But your code in `test.js` is not correct. However, you should still see error messages within VSCode—I don't think that's even configurable. – Álvaro González Apr 19 '20 at 11:41
  • But @ÁlvaroGonzález the ```test.js``` is a simple console.log, so i don' understand how it can't work. – Paulo Brás Apr 19 '20 at 12:16
  • If you're positively sure your code is correct then there must be something broken elsewhere. But it won't run inside Code if it doesn't run at all. – Álvaro González Apr 19 '20 at 15:01

1 Answers1

1

I had the same problem because of installed Nodejs from Ubuntu store instead terminal. I solved it reinstalling Node from terminal. Use this tutorial https://www.google.com/amp/s/www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-20-04-es.amp