6

How to prepare a Node.js dev environment on MacOS

 2 years ago
source link: https://dev.to/joncodes/how-to-prepare-a-node-js-dev-environment-on-macos-2la5
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

You will need node (required), git (optional), and yarn (optional) to develop Node applications. I also use an optional package manager, homebrew to install these tools.

To check whether you already have these tools, you can run:

  • brew -v
  • node -v
  • yarn -v
  • git --version

If these commands each output a version number, you already have the tools installed and you are ready to go.

Homebrew

Homebrew is an extremely useful package manager for Mac. To install it, run the following:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Enter fullscreen modeExit fullscreen mode

Node.js

Node.js is a Javascript runtime that executes in a server environment.

Install Node.js if you don't already have it. On Mac, you can easily install it using the Homebrew package manager (or from the project website):

brew install node
Enter fullscreen modeExit fullscreen mode

Git is a version control system that allows you to store your code in a centralized repository that tracks your changes and can easily be backed up remotely to a service like Github.

You can install Git on Mac using Homebrew (or from the project website):

brew install git
Enter fullscreen modeExit fullscreen mode

Go ahead and configure your git identity:

git config --global user.name "YOUR NAME"
git config --global user.email "YOUR EMAIL"
Enter fullscreen modeExit fullscreen mode

I prefer to use the Yarn package manager for Node, instead of NPM (which is the default package manager that comes installed with Node).

Again, on Mac you can install it using Homebrew (or from the project website):

brew install yarn
Enter fullscreen modeExit fullscreen mode

All set!

You're ready to start developing Node applications on MacOS! The only other thing you will need is a text/code editor, if you don't already have one. I use vscode, but you can use any editor you like.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK