Download the. PKG file of the node from the official website to install the node. After installation, enter NPM – V and node – V in the MAC terminal to prompt command not found. Refer to the method on the Internet, and finally get the solution
Step 1: create. Bash_ Profile file, ~ means in the ~ directory,. Means hidden file. Open the terminal and enter the following command
touch ~/.bash_profile
Step 2: open. Bash_ The input command is as follows:
open -t ~/.bash_profile
Step 3: a blank text edit box will pop up. Edit the first line in the text edit box
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Command + s saves the file
Step 4: save. Bash_ Profile file, enter the command:
source .bash_profile
Step 5: enter NPM – V or node – V again to see the version number~