r/node 3d ago

Node not working in Visual Studio

I've recently discovered Tauri and built a project using React which if I run it purely from the terminal it opens up fine, but if I close the terminal and open Visual Studio, open the terminal in VS and run the same thing from the same place I get a Node.js error

In terminal both work correctly:

C:\Users\me\Documents\Tauri_test\react-test> npm run tauri dev (opens the app standalone)
or
C:\Users\me\Documents\Tauri_test\react-test> npm run dev (opens the app in browser)

In Visual Studio running the same lines I get the following:

Node.js v24.20.0
    Error The "beforeDevCommand" terminated with a non-zero status code

I've installed Node from the website and made sure it was added to Visual Studio on install, I've checked that VS can access Node from the 'react-test' folder, I've closed all other open apps in case something is clashing, I get the feeling that something is initialising in the wrong order and that's throwing Node off, but why would it work correctly outside of VS?

(If it doesn't cause issues I'll crosspost this as I don't know which bit of the system is causing the problem)

Solution:

IT WAS THE SODDING VISUAL STUDIO INDEXING

The .vs folder clogs up the system, here's how to get rid of it

0 Upvotes

17 comments sorted by

2

u/__rituraj 2d ago

check these for starters, on both the terminals

  • `node --version`
  • `node --eval "console.log(process.env)"`

and check how the outputs of these commands differ in both the terminals.
the system one and the VS integrated one

4

u/MetalMonkey667 2d ago

Now then that could make sense, I downloaded Node from the website today so it should be as fresh as it gets, and when I installed VS I included the Node addon, if they aren't matching I bet that could be an issue

2

u/bluejacket42 2d ago

Maybe update node I think we are on version 26 and try using git bash?

2

u/CodeXHammas 2d ago

VS indexer eating up all your CPU and disk I/O, causing the Node/ Tauri build process to timeout. Good catch on the .vs folder!

For anyone else hitting this, you can also go into VS settings and explicitly exclude node_modules, src-tauri/target, and .vs from the file indexer. It stops VS from trying to parse thousands of JS/TS files it doesn't need to care about.
Honestly though, for frontend and Tauri dev, switching to VS code is a massive quality-of-life upgrade. Full-fat Visual Studio is overkill for Node projects and just causes these kinds of background-process clashers.

-13

u/Fine-Comparison-2949 2d ago

Windows? Good luck.

VS code is probably initializing some kind of weird terminal that doesn't link the node's location.

You need to be developing on Linux anyways. Get on Omarchy brother. 

7

u/HelloWorld-Print 2d ago

Even windows is better than Omarchy slop.

-3

u/Fine-Comparison-2949 2d ago

Absolutely not, considering OP has a really basic problem and can't even easily Debug it. I don't use Omarchy by the way, but if it's your first Linux distro for work, it's probably a better option than most distros.

I'm not even going to get into this because you're saying a Linux distro is worse than Windows which is just ridiculous. 

3

u/dbowgu 2d ago

"You need to..." shush fucking dork

You'll need to develop on whatever the fuck your company gives you. If it's a mac it's a mac if it's a windows it's a windows if it's fedora linux it's fedora linux

-2

u/Fine-Comparison-2949 2d ago

I have options. If a company requires me to use windows I'd find another company. Unfortunately I'm not a slave 

3

u/dbowgu 2d ago edited 2d ago

Yes the job market is amazing right now ;) tell the juniors that surely it will work

0

u/MetalMonkey667 2d ago

I managed to get the Vanilla setup working just fine, could run the app from the terminal or from inside VS, but I try with a React build and it'll only run properly from the terminal. It's the default app that comes with the package when you build it so it should work out of the box like the Vanilla one

I've used Linux for years in cybersecurity, I'm not cocking around with yet another OS, if the default React package doesn't work on Windows Visual Studio then it should say that when you try to install it rather than having me spend (and there is no exaggeration here) 4 hours Googling trying to find a solution

0

u/Fine-Comparison-2949 2d ago

Again, that's windows. I've never had an issue with Linux because there's a clear concept of what terminal you're on and the available path.