getting node.js npm to work behind a corporate proxy

I’ve recently been having fun with the Prince’s Trust, running a workshop for the Get into Tech programme, playing around with Arduinos and smart phones and stuff. My boss suggested for the next iteration, we look at maybe getting a light to tweet its state. this sounds like excellent fun, and i recalled watching a youtube video where Rodric Yates gets something similar running in five minutes… awesome.

so… i thought i’d install node-RED on my work desktop, and see if we could do something similar.

 

issue 1 – the standard install (once you have node.js installed, that is) uses npm, the node.js package manager. we’re behind a corporate firewall that requires authentication. to get npm to work through a proxy, find the .npmrc file somewhere in your profile folder:

image

open it up with notepad and add the line:

proxy=http://username:password@proxyaddress:port

eg

proxy = http://nickparlow:P4$$w0rd!@my.default.proxy.local:8080

yeah. that’s my password. i am sooooo 1337. (do the cool kids still say that?)

you may also struggle with https, even after you’ve added a line like:

https-proxy = http://nickparlow:P4$$w0rd!@my.default.proxy.local:8080

and:

strict-ssl = false

in which case, give up and use:

registry = http://registry.npmjs.org

which bypasses ssl altogether.

 

success!

image

Advertisements
Post a comment or leave a trackback: Trackback URL.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: