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:
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
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 toindex.js
now node works correctly.This issue with VS Code’s output may stem from various sources.
Sometimes, outdated versions can cause unexpected behaviour.
temporarily. Sometimes, extensions might conflict and affect the
output.
%APPDATA%Code
(Windows)or~/Library/Application Support/Code
(macOS)and deleting the
Cache
andCached Data
folders.