DEV Community

Yegor Shytikov
Yegor Shytikov

Posted on

Magento 2 Node JS NVM MacOS (Node Version Manager) Setup

Modern Web end Magento is not possible without the NodeJS. More and more merchants using NodeJS over PHP. To have proper LTS node version is really important.

Install NVM

To install or update nvm, you should run the install script. To do that, you may either download and run the script manually, or use the following cURL or Wget command:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.37.0/install.sh | bash
Enter fullscreen mode Exit fullscreen mode

Running either of the above commands downloads a script and runs it. The script clones the nvm repository to ~/.nvm, and attempts to add the source lines from the snippet below to the correct profile file (~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc).

export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
Enter fullscreen mode Exit fullscreen mode

Install Node

Now go over to https://nodejs.org where I see it’s telling me the latest stable release is v10.15.0 LTS. I see there is a v11.8 Current with all the latest features, but I’m not using that one today.

So I simply use the terminal and nvm to install it with

nvm install 10.15.0
Enter fullscreen mode Exit fullscreen mode

I’ll set the current version I want to use to the same

nvm use 10.15.0
Enter fullscreen mode Exit fullscreen mode

Check node version

node -v
Enter fullscreen mode Exit fullscreen mode

output:

yehor.shytikov % node -v
v14.15.0
Enter fullscreen mode Exit fullscreen mode

Top comments (0)