search
HomeWeb Front-endFront-end Q&AHow to install Node.js on Mac

How to install Node.js on Mac

Apr 26, 2023 am 09:09 AM

Node.js is a JavaScript runtime environment based on the Chrome V8 engine. It enables JavaScript to run on the server side, which allows developers to write server-side applications in JavaScript. The emergence of Node.js not only unifies the development languages ​​of the front-end and back-end, but also greatly improves development efficiency.

This article will introduce how to install Node.js on Mac system. The installation of Node.js is roughly divided into the following two methods:

  1. Download the installation package through the official website
  2. Install NVM through the command line

Method 1: Download the installation package through the official website

  1. Open the official website of Node.js and find the download page: https:// nodejs.org/en/download/
  2. Click the "macOS Installer" button to download the installation package.

How to install Node.js on Mac

  1. After the download is completed, you will see a file named "node-vXX.XX.X.pkg" (XX. XX.X is the version number) installation package.
  2. Double-click the installation package and follow the steps of the installation wizard.

How to install Node.js on Mac

  1. After the installation is complete, enter the following command in the terminal:
node -v

If the version number appears, the installation is successful. .

Method 2: Install NVM through the command line

  1. First, enter the following command in the terminal to install Homebrew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  1. After the installation is successful, Enter the following command to install NVM:
brew install nvm
  1. After the installation is complete, enter the following command in the terminal to configure NVM:
mkdir ~/.nvm
nano ~/.bash_profile
  1. Open "bash_profile" Add the following code to the file:
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh

Save and exit the file.

How to install Node.js on Mac

  1. Enter the following command in the terminal to make the modified configuration take effect:
source ~/.bash_profile
  1. Enter the following command to view the latest Node .js version number:
nvm ls-remote
  1. Enter the following command in the terminal to install Node.js:
nvm install 版本号

For example, install the latest version of Node.js:

nvm install node
  1. After the installation is complete, enter the following command in the terminal to verify whether Node.js is installed successfully:
node -v

If the version number appears, it means the installation is successful.

So far, the two methods of installing Node.js on Mac systems have been introduced. If you want to uninstall Node.js, you can enter the following command in the terminal:

sudo rm -rf /usr/local/{bin/{node,npm},lib/node_modules/npm,lib/node,share/man/man1/node.1.gz}

Note: Before executing, please make sure to back up the files that need to be retained.

The above is the detailed content of How to install Node.js on Mac. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
What are the limitations of React?What are the limitations of React?May 02, 2025 am 12:26 AM

React'slimitationsinclude:1)asteeplearningcurveduetoitsvastecosystem,2)SEOchallengeswithclient-siderendering,3)potentialperformanceissuesinlargeapplications,4)complexstatemanagementasappsgrow,and5)theneedtokeepupwithitsrapidevolution.Thesefactorsshou

React's Learning Curve: Challenges for New DevelopersReact's Learning Curve: Challenges for New DevelopersMay 02, 2025 am 12:24 AM

Reactischallengingforbeginnersduetoitssteeplearningcurveandparadigmshifttocomponent-basedarchitecture.1)Startwithofficialdocumentationforasolidfoundation.2)UnderstandJSXandhowtoembedJavaScriptwithinit.3)Learntousefunctionalcomponentswithhooksforstate

Generating Stable and Unique Keys for Dynamic Lists in ReactGenerating Stable and Unique Keys for Dynamic Lists in ReactMay 02, 2025 am 12:22 AM

ThecorechallengeingeneratingstableanduniquekeysfordynamiclistsinReactisensuringconsistentidentifiersacrossre-rendersforefficientDOMupdates.1)Usenaturalkeyswhenpossible,astheyarereliableifuniqueandstable.2)Generatesynthetickeysbasedonmultipleattribute

JavaScript Fatigue: Staying Current with React and Its ToolsJavaScript Fatigue: Staying Current with React and Its ToolsMay 02, 2025 am 12:19 AM

JavaScriptfatigueinReactismanageablewithstrategieslikejust-in-timelearningandcuratedinformationsources.1)Learnwhatyouneedwhenyouneedit,focusingonprojectrelevance.2)FollowkeyblogsliketheofficialReactblogandengagewithcommunitieslikeReactifluxonDiscordt

Testing Components That Use the useState() HookTesting Components That Use the useState() HookMay 02, 2025 am 12:13 AM

TotestReactcomponentsusingtheuseStatehook,useJestandReactTestingLibrarytosimulateinteractionsandverifystatechangesintheUI.1)Renderthecomponentandcheckinitialstate.2)Simulateuserinteractionslikeclicksorformsubmissions.3)Verifytheupdatedstatereflectsin

Keys in React: A Deep Dive into Performance Optimization TechniquesKeys in React: A Deep Dive into Performance Optimization TechniquesMay 01, 2025 am 12:25 AM

KeysinReactarecrucialforoptimizingperformancebyaidinginefficientlistupdates.1)Usekeystoidentifyandtracklistelements.2)Avoidusingarrayindicesaskeystopreventperformanceissues.3)Choosestableidentifierslikeitem.idtomaintaincomponentstateandimproveperform

What are keys in React?What are keys in React?May 01, 2025 am 12:25 AM

Reactkeysareuniqueidentifiersusedwhenrenderingliststoimprovereconciliationefficiency.1)TheyhelpReacttrackchangesinlistitems,2)usingstableanduniqueidentifierslikeitemIDsisrecommended,3)avoidusingarrayindicesaskeystopreventissueswithreordering,and4)ens

The Importance of Unique Keys in React: Avoiding Common PitfallsThe Importance of Unique Keys in React: Avoiding Common PitfallsMay 01, 2025 am 12:19 AM

UniquekeysarecrucialinReactforoptimizingrenderingandmaintainingcomponentstateintegrity.1)Useanaturaluniqueidentifierfromyourdataifavailable.2)Ifnonaturalidentifierexists,generateauniquekeyusingalibrarylikeuuid.3)Avoidusingarrayindicesaskeys,especiall

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor