NPM watch stops automatically after WSL


I recently switched to WSL due to a performance issue and now my npm watch process stops instantly after launching. It successfully builds the Sass file, which is currently the only build file, but then it stops right after creating the file.

I’m not sure what’s going wrong. It used to work fine with the standard installation. I’m not a professional coder; I’m just trying to navigate through simple tutorials and use GPT to help out.

Hi @Imabi :wave:

Welcome to the the Kinsta Community!

I don’t have personal experience using npm watch process but could you try adding a --verbose parameter in the command (npm run watch --verbose) to hopefully provide more details as to why the process stops?

Let us know how it goes.

Hi @Imabi :wave:

I also just wanted to check and mention, that as you’re using WSL now, I’m wondering if the issue you’re experiencing with the NPM issue above might be related to the UNC path thing? :thinking: - which you would need to map the WSL network path to an actual local drive in Windows first (if you haven’t done so?)

Could you please confirm if that Z:\ drive is the actual local drive you have in your Windows machine? or is that a mapped drive already (that’s mapping to your WSL network path: \\wsl.localhost\docker-desktop-data\ ?)

In case you haven’t mapped the local drive to that WSL network path, perhaps you may want to try to perform this command line (in Command prompt) something like this:

net use x: \\wsl.localhost\docker-desktop-data

(note: where x: can be changed with any local drive you would want to map/assign for that WSL network path - as long as that “x” drive does not exist on your local computer) - similar to the one I mentioned in the other thread here and here .

Once done, you can go to that x: drive via command prompt , and there CD to that folder:
and see if you can perform that npm command line? :pray:

Best regards,
Agus Utomo

Hi Adrian,

check out the following screenshot, do you see anything unusual?

Hi Agus,

the mapping should be fine, check this out:

Screenshot 2024-04-17 154309

Hello @Imabi,

I am afraid I couldn’t find any clear entry as to why the process is stopping based on the screenshot you provided. Nevertheless, I suggest that you try increasing the CPU and Memory allocated for the Docker Desktop to see if that fixes the issue. You can do this by navigating to Docker >> Settings >> Resources page. Additionally, you may want to temporarily disable Docker’s Resource Saver feature and check if that helps.

I hope this information is helpful to you. Please keep us posted on how it goes.

Unfortunately, didn’t work out.

I also tried to change the node.js version from 64bit to 32bit, didn’t work.

Additionally I tested if it works outside the Z / Docker folder and yes, the problem is just inside the Z / Docker folders.

DevKinsta is becoming really annoying, without WSL it doesn’t work properly, hangs itself, super slow and with Docker we have other issues…

Hello @Imabi :wave:

While this might be a local issue on your end, I did ask our Devkinsta engineers for an advice on how to approach this and what else can be done.

We will update you once we have a suggestion.

Thank you!

Hello again @Imabi :wave:

We still haven’t heard an update yet from our DevKinsta engineers as my colleague reported few days ago.

Anyway, I’m just wondering what if you run that NPM command line directly within the devkinsta_fpm docker’s container (via its Terminal/Exec tab) instead of from that Z: network drive that’s mapped to the WSL path?

On your docker desktop → Containers menu, click on the “devkinsta_fpm” name:

then on that “devkinsta_fpm” container page, click on the “Exec” tab (to open the “terminal” of that container:

there, you may want to go inside your local site folder by typing something like:
cd /www/kinsta/public/yoursitenamehere
and try to run the npm command line? if it works there? :thinking:

If it says that NPM is not found (i.e: /bin/sh: 9: npm: not found ), then you will need to install NPM/NodeJS in that “devkinsta_fpm” container .

To install it on that docker’s container, you can run the following one-line command in that “Exec” tab (terminal) on your Docker Desktop:

curl -fsSL | sudo -E bash - ; sudo apt-get install -y nodejs

(which I took from this external site)

then you can check if NPM and NodeJS have been installed properly, with:

npm -v


node -v

After that, please try to perform your NPM command line you tried before in your local site’s path/folder and see if it will work fine there? :pray:

Best regrads,
Agus Utomo