Installing LESSC with a Proxy and a funky p@ssword in command line
I am slowly migrating all native legacy CSS from a high traffic website and it's counterpart web application into LESS. Normally, I work out of an environment that has all the goodies already available: Git, Node, Lessc. But today I have the need to also have it on my local machine, as everything I do now is in LESS and Git, even small stand alone landing pages. Can't live without them.
So I've decided to install lessc on my machine at work. We have Windows machines to the dismay of 90% of my web developer peeps, and we are behind a proxy too, and my user password changes every three months.
Installing Node.js was easy, it also installed NPM. Now to LESSC!
Because of the proxy server, this:
$ npm install -g less
will return an error for the proxy. So what to do??
Also, because my password changes every month, setting an environment variable, for me, was too frustrating. I discovered there's a way to pass the proxy info only whenever you need, which worked for me.
In the shell type the following:
npm --proxy http://user:[email protected]:port# install -g less
But hey, my password has an @ signs and is throwing errors! This is because the ' @ ' sign indicates which host you want to connect to, it will take whatever text after the @ as part of you host name. So what to do, eh? This article explains that special characters need to be encoded in hex. So @ = %40, or ! = %21. For more character entities and hex codes see this page.
Knowing that @ is %40 in hex, let's try this again:
$ npm --proxy http://user:p%[email protected]:port# install -g less
Now the LESS installation command should work.
For further LESSC installation behind a proxy using windows command prompt, try these articles:
http://superuser.com/questions/347476/how-to-install-npm-behind-authentication-proxy-on-windows
and:
http://stackoverflow.com/questions/11718952/using-lessc-on-windows
Good luck!














