I'm using npm version 8.1.2 inside Ubuntu 20.04 in windows subsystem for linux 2 (WSL2).
I've been trying to install 5 dependencies for my project, yet the installation hangs.
npm install solc web3 mocha ganache-cli @truffle/hdwallet-provider --verbose
Yet, installation is taking forever (over 10 hours).
I already checked the following:
npm config set registry http://registry.npmjs.org/
Has anyone encountered this issue before? What has been the solution?
PS. There are indeed many topics regarding speed of npm install in stackoverflow, yet, I have already read a lot of them, which led me to testing the 4 topics mentioned before.
Assuming you are not working on files mounted in /mnt
then the following worked for me. As a quick test I did wget -O - https://registry.npmjs.org
and it was pretty obvious thaty name resolution was somehow the culprit.
I had the same issue and solved it by creating the /etc/wsl.conf
file adding the following:
[network]
generateResolvConf = false
Then I replaced the existing /etc/resolv.conf
symlink so you will have to remove it and then recreate it using your favourite text editor adding the following:
nameserver 8.8.8.8
Replace 8.8.8.8
with whatever IP address your DNS server of choice has, if you don't want to use Googles.
When done restart your WSL instance by running wsl --shutdown
in an elevated Windows command prompt, then you can start your WSL instance like you normally would.
I don't know why the name resolution is so slow using the stock resolv.conf
configuration, but this workaround makes it normal again.
After following the steps, it continues with the same slowness on the internet within ubuntu
Unfortunately, possibly there still no solution for this problem due to this issue .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.