skip to Main Content

I was trying to run a node code with code runner but vs code shows an invisible output when it executes. Previously, node was working just fine on my vs-code terminal but now I don’t know what is the problem. when I try to type the command node --version it show an empty field as shown below:

Node is not working after typing node --version

The result is the same when I try to run a node file with code runner in vs code. Also, node works just fine in the cmd and in the PowerShell.

I’ve tried to reinstall node but the problem is still the same. I tried to use nvm but some of the output of nvm was hidden & it missed up everything so I uninstalled it. I checked if node executes an invisible output or an empty field by trying to make an infinite loop file and executes it, and the output was the same (an empty field).

2

Answers


  1. Chosen as BEST ANSWER

    It turns out that it is the name of the file what was causing the conflict. because the file was named node.js when I changed the file name to index.js now node works correctly.


  2. This issue with VS Code’s output may stem from various sources.

    • Ensure that you are using the latest version of Visual Studio Code.
      Sometimes, outdated versions can cause unexpected behaviour.
    • Disable any extensions related to Node.js or code runners
      temporarily. Sometimes, extensions might conflict and affect the
      output.
    • Clear the VS Code cache. You can do this by going to
      %APPDATA%Code (Windows)or ~/Library/Application Support/Code (macOS)
      and deleting the Cache and Cached Data folders.
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search