Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

d3lus10n's avatar

Laravel Herd JavaScript error on Windows

Recently, I installed Laravel Herd on both of my Windows accounts. Everything is working correctly. Both share the Herd installation path in C:\Program Files, but they have the binaries in their respective user folders.

The error occurs when I switch from one account to another (even after shutting down the PC). In one of them, I encounter the following error:

A JavaScript error occurred in the main process

Uncaught Exception:
Error: listen EADDRINUSE: address already in use :::9001
at Server.setupListenHandle [as _listen2](node:net1817:16)
at listenInCluster (node:net:1865:12)
at Server.listen (node:net:1953:7)
at Function.listen (C:\Program Files\Herd\resources\app.asar\node_modules\express\lib\application.js:635:24)
at Server.start (evalmachine.<anonymous>:1:48789)
at evalmachine.<anonymous>:1:593865

When I execute the command Get-Process -Id (Get-NetTCPConnection -LocalPort 9001).OwningProcess to check the process of port 9001, I get the following:

 NPM(K) PM(M) WS(M) CPU(s) Id SI ProcessName
 ------ ----- ----- ------ -- -- -----------
 54 83.55 121.07 0.00 74980 13 Herd

In both accounts, I have Herd configured to start automatically, so I wonder if this could be causing a conflict since there are several Herd processes in the Task Manager.

Also, when installing Herd, it installs Node in the directory C:\Program Files\nodejs, which is in the system variables (for both accounts), such as:

  • NVM_SYMLINK: C:\Program Files\nodejs

The environment variables for each account are as follows (the same for both accounts, only the username changes):

  • NVM_HOME: C:\Users\username.config\herd\bin\nvm
  • Path: C:\Users\username.config\herd\bin;C:\Users\username.config\herd\bin\php83;C:\Program Files\nodejs;C:\Users\username.config\herd\bin\nvm

I wonder if the error could also be related to how Node is installed and interacted with since both accounts share the SYMLINK.

As an additional note, if I close the error, everything seems to work fine, but I'm not completely at ease. It also occurs to me that a possible solution would be to change the port for each user account. I imagine it must be specified somewhere in the binaries.

I'm not sure if what I've said makes sense or not but thanks for reading and I appreciate any response! 💕

0 likes
2 replies
gych's avatar

First try to disable that Herd starts automatically on start up and see if that still causes the same issue.

d3lus10n's avatar
d3lus10n
OP
Best Answer
Level 6

@gych I tried changing the port in the Herd config file of one of the accounts, but that triggered other problems (it was not able to start the desktop app and find the Sites folder). So yes, the easiest thing to do was to disable auto-start on both accounts, and just start it myself when I need it.

Please or to participate in this conversation.