Sometimes the following error appears on Ubuntu Linux when building docker images for nodejs
projects and the project includes privately scoped node packages.
|
|
Initial workaround
The initial naive workaround we used was to manually change our DNS entry in /etc/resolv.conf to point to the local gateway.
/etc/resolv.conf
Then manually stop the systemd-resolved service.
|
|
Better workaround
We found a better solution to the problem in Stack Overflow.
First open the DHCP configuration file for editing:
|
|
Then uncomment the following two lines and replace the default values with our DNS address and private NPM registry host. If we want to use as DNS 10.0.0.1 and host npm.ourdomain.com
, we would end up with the following lines:
Finally, reboot Ubuntu and it should work like charm. If it still doesn’t, check the accepted answer in the SO post.