Monday, September 5, 2016

Installing nodejs without admin rights and behind proxy

Select directories for NODE_PATH and add it to the path

Download node-v6.5.0-win-x64.zip(or the one for your platform) from http://nodejs.org/dist/latest/ into NODE_PATH
Unzip the file into the NODE_PATH directory
remove file "npm" in the directory if you want to change the "prefix" and "cache" settings to the same directory

Use the following commands to store the proxy in configuration
    npm config set proxy http://proxy.company.com:8080
    npm config set https-proxy http://proxy.company.com:8080

After this the npm commands should go through the proxy

If you need to specify credentials, they can be passed in the url using the following syntax.
    http://user_name:password@proxy.company.com:8080

Configuration parameters can be specified using -- when executing npm. So the proxy could also be specified as follows.
    npm --https-proxy=http://proxy.company.com:8080 -g install karma

To set the npm directories use the following commands
npm config --global set prefix "C:\ProgramData\npm"
npm config --global set cache "C:\ProgramData\npm-cache"