On a recent assignment, I needed to install npm behind a corporate proxy. I had already set the environment variables HTTP_PROXY and HTTPS_PROXY. Other command line utilities, like ruby gems, recognized these environment variables. Npm did not.
After some googling, I found the following way to configure the proxy for npm.
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080
If you need to specify credentials, they can be passed in the url using the following syntax.
Further exploration of the npm config documentation showed that the npm config set command sets the proxy configuration in your .npmrc file. You can also set the proxy configuration as a command line argument or environment variable.
Configuration parameters can be specified using -- when executing npm. So the proxy could also be specified as follows.
There are several ruby performance patches, like the falcon patches, that may improve the performace of your application.
I use rvm and was pleased to learn that rvm supports compiling ruby with several of these performance patches. Using rvm with the railsexpress patch, I saw a 20% reduction in the time required to run the test suite for a large rails project.
Here is how you can install ruby with the railexpress patch using rvm.
First make sure you have the latest version of rvm.
rvm get head
Next install ruby 1.9.3 with the railsexpress patch. At this step rvm may have dependencies that require installation.
rvm install 1.9.3 --patch railsexpress
The railsexpress patch contains the following patches.