So I was trying to install «nativefier» (a software developed on top of ElectronJS) to make any website a desktop application.

Because I was behind a corporate firewall I had some troubles making npm work:

mortiz@alberta:~/Documents$ npm install nativefier -g
npm ERR! errno ENOTFOUND
npm ERR! network request to failed, reason: getaddrinfo ENOTFOUND
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network 
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'

Although I tried exporting my proxy settings in the console it didn’t work:

export https_proxy="http://proxyXXXXXXXXX:8XXX"
export http_proxy="http://proxyXXXXXXXXX:8XXX"

After some search in Google you can set the proxy settings for NPM (note the difference between (http_proxy Linux Environment) and http-proxy (NPM Environment):

npm config set proxy http://X.X.X.X:80
npm config set https-proxy http://X.X.X.X:80

Some user even reported for «https» to work you must add the «=» sign:

npm config set https-proxy="http://X.X.X.X:80"

After adding those proxy in my environment it appeared to work but a new error appeared:

npm WARN checkPermissions Missing write access to /usr/lib/node_modules
npm ERR! path /usr/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules'
npm ERR!  { Error: EACCES: permission denied, access '/usr/lib/node_modules'
npm ERR!   stack: 'Error: EACCES: permission denied, access \'/usr/lib/node_modules\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/lib/node_modules' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

And when you use «sudo» you’ll have the «getaddrinfo ENOTFOUND»  error again. This has sense because when you do (npm config set http-proxy) it will store those values in your .npmrc file:

mortiz@alberta:~/Documents$ cat /home/mortiz/.npmrc

So I’ve just copied it to /root:

mortiz@alberta:~/Documents$ sudo cp -rp /home/mortiz/.npmrc /root/
mortiz@alberta:~/Documents$ sudo cat /root/.npmrc

After that, everything worked:

mortiz@alberta:~/Documents$ sudo npm install nativefier -g
/usr/bin/nativefier -> /usr/lib/node_modules/nativefier/lib/cli.js
+ nativefier@7.6.1
added 323 packages in 11.484s