Javascript
To streamline your JavaScript development, it’s crucial to have Node.js and npm (Node Package Manager) installed. Instead of manually installing different Node.js versions and switching between them, we recommend using nvm (Node Version Manager) which allows for easy installation and management of multiple Node.js versions.
macOS Setup
-
Install Homebrew (if you haven’t already…Just go here) for instructions
-
Install nvm using Homebrew With Homebrew installed, you can now install
NVM:Terminal window brew install nvm -
Configure nvm
Add the following to your shell profile (
~/.bash_profile,~/.zshrc, etc.):Terminal window export NVM_DIR="$HOME/.nvm"[ -s "/usr/local/opt/nvm/nvm.sh" ] && \. "/usr/local/opt/nvm/nvm.sh"[ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/usr/local/opt/nvm/etc/bash_completion.d/nvm"Then, restart your terminal or run
source ~/.bash_profile(or your respective shell profile file). -
Install Node.js using nvm
With
nvmconfigured, you can install the latest version of Node.js:Terminal window nvm install node
Windows Setup
-
Install Scoop (if not installed… Just go here for instructions)
-
Install
nvmusing ScoopWith Scoop installed, you can install
nvm:Terminal window scoop install nvm -
Install Node.js using nvm
With
nvminstalled, you can install the latest version of Node.js:Terminal window nvm install latest
Common nvm Actions
Once you’ve set up nvm, you have access to a variety of commands that help manage your Node.js versions. Below are some basic actions to get you started:
Listing Installed Node Versions
To see a list of Node.js versions you have installed:
nvm listSwitching Between Node Versions
If you’ve installed multiple versions of Node.js, you can easily switch between them:
nvm use [version]Replace [version] with the desired version number, e.g., nvm use stable.
Setting a Default Node Version (macOS only)
On macOS, you can set a default Node.js version that will be used in any new shell:
nvm alias default [version]Replace [version] with your preferred version number, e.g., nvm alias default stable.
Setting up npm proxy
To set up npm proxy globally, run the following commands:
npm config set proxy http://proxy.company.com:8080npm config set https-proxy http://proxy.company.com:8080Optionally, you can set up a proxy in your project by creating a .npmrc file at your project root and adding the following:
registry=http://your.internal.registry.org/sass_binary_site=https://your.internal.binary.sass.site/strict-ssl=false