Home >Web Front-end >Front-end Q&A >terminal install nodejs
To install Node.js in the operating system, you generally need to use the command line or terminal. This article will provide specific steps and precautions to help you successfully complete the installation of Node.js.
Before using the terminal to install Node.js, you need to install the necessary software, including the compilers and libraries that Node.js depends on. document. You can install by entering the following command in the terminal:
In Ubuntu or Debian run:
sudo apt-get update
sudo apt-get install build-essential
Run in Fedora:
sudo dnf groupinstall "Development Tools"
sudo dnf install curl
Run in CentOS:
sudo yum groupinstall "Development Tools" "
sudo yum install curl
Run in macOS:
xcode-select --install
After installing the necessary software, we need to download the Node.js installation package from the official website. You can open a terminal and enter the following command:
curl -sL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs
After running the above command, the terminal will start to download Node.js and install it. You can wait patiently during the download process, or enter instructions during the installation process to get more details.
After the installation is complete, you can enter the following command to verify whether Node.js has been installed correctly:
node - v
If you see output similar to "v12.18.3", it means you have successfully installed Node.js. If you encounter an error or the command cannot be executed, please carefully check whether the software in your system meets the installation requirements, or try to execute the installation command again.
After installing Node.js, you can also install many other tools and modules for Node.js. These tools can be managed and operated quickly and efficiently using the command line and terminal, allowing you to better utilize and develop Node.js-based applications.
The above is the detailed content of terminal install nodejs. For more information, please follow other related articles on the PHP Chinese website!