Node.js is a powerful JavaScript runtime. Its package ecosystem called npm, included, is very often used to install development frameworks that use JavaScript (Angular, Ionic, JHipster …)
To install Node.js :
- Download on the official Node.js website the latest LTS version (Long Term Support)
- Install it
- Check that the installation is correct by running node -v, which must return the version number
To install npm
- The npm package manager is included with the installation of Node.js
- To check the npm version, run : npm -v
- To be sure to have the latest npm version (which changes more often than Node.js), run : npm install npm@latest -g
latest tells to install the latest version,
-g to install it globally. npm is then available everywhere on your machine (not just in the current folder).
Set the proxy
If you use npm on a corporate network, you will probably need to set the proxy. Otherwise, you’re done !
Method 1 : environment variables
Define two environment variables, that tell npm what is the proxy server, its port, and your credentials.
Windows Example :
HTTPS_PROXY=http://user:password@server:port
HTTP_PROXY=http://user:password@server:port
Method 2 : with npm configuration
The proxy can be set by running npm commands.
Windows Example :
npm config set https-proxy "http://user:password@server:port/"
npm config set proxy "http://user:password@server:port/"
The values are then stored in the user-home-folder\.npmrc
file.