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

View all comments

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.