wasp
wasp copied to clipboard
Wasp on WSL: npm install is sometimes super slow?
We had a couple of people say that Wasp's npm install is super slow on WSL for them. Something like 40 minutes and more, which is ridiculous. I am guessing this happens only in certain setups or we would hear more about it. Maybe it has to do with them running it on Win vs Linux filesystem, which is a common mistake? Or how they have WSL set up?
Let's track this here!
Win vs Linux filesystem, which is a common mistake
I think we should have a check+warning for this in the compiler. (related #1857)
Possibly related: #2262
I helped a user earlier today that had a super slow npm i by just asking them to upgrade to the latest npm (npm i -g npm) and it did speed up their install. Discord
When I started using Wasp I started running it on Windows instead of Linux file system.
At that time the hot reload didn't work (I had to do ctrl+c and wasp start to see changes) and when installing the OpenSaaS template dependencies, it took me up to 40-50 minutes.
When I moved Wasp to the Linux filesystem the hot reload started working and the installation time was much less.
I've cheched now that my Laptop took 19 min to npm install a new OpenSaaS Template.
OS: W10 (WSL2) CPU: 8C/16T RAM: 16GB Download speed: ~350Mbps
When I started using Wasp I started running it on Windows instead of Linux file system.
At that time the hot reload didn't work (I had to do
ctrl+candwasp startto see changes) and when installing the OpenSaaS template dependencies, it took me up to 40-50 minutes.When I moved Wasp to the Linux filesystem the hot reload was working and the installation time was much less.
I've cheched now that my Laptop took 19 min to
npm installa new OpenSaaS Template.OS: W10 (WSL2) CPU: 8C(16) RAM: 16GB Download speed: ~350Mbps
Thanks @NeroxTGC , this helps a lot! Ah yes, Windows file system would explain that.
When you say that your laptop took 19 mins to npm install a new OpenSaaS template -> is that how long it takes now that you run it on WSL but on Linux file system, or is this the time it took before when you were doing it on Windows file system?
@Martinsos This is how long it takes me now with the Linux filesystem.
It seems it might be related to network issues and not disk issues. Setting a new DNS seems to solve the issue in some cases:
- https://www.reddit.com/r/bashonubuntuonwindows/comments/nt8asc/comment/hk7zpbw/
- https://github.com/microsoft/WSL/issues/7254#issuecomment-905767204
It seems it might be related to network issues and not disk issues. Setting a new DNS seems to solve the issue in some cases:
- https://www.reddit.com/r/bashonubuntuonwindows/comments/nt8asc/comment/hk7zpbw/
- Node.js and NPM network dramatically slow microsoft/WSL#7254 (comment)
Oh interesting, @NeroxTGC if you happen to have time to try this out, would be great, so we can know if this helps.
First of all I will try updating my npm version, now is: v10.7.0
Ok, It took the same time with the latest LTS version: v22.15.0 (19 min)
Next, after testing the solution of:
in wsl, type below.
sudo rm /etc/resolv.conf sudo bash -c 'echo "nameserver 8.8.8.8" > /etc/resolv.conf' sudo bash -c 'echo "[network]" > /etc/wsl.conf' sudo bash -c 'echo "generateResolvConf = false" >> /etc/wsl.conf' sudo chattr +i /etc/resolv.confAfter that, type below in cmd with administrator.
wsl --shutdown
It took the same time, 19 min.
btw the solution message also says:
Did 4 reboots - works as expected.
And some mention about disabling IPv6
So I will try that and reboot a few times.
Uff! Ok thanks a lot @NeroxTGC for trying all this, that helps.
No news from my side, I have not managed to reduce the time.
Related: https://github.com/wasp-lang/wasp/issues/2331 .