Home  >  Article  >  Operation and Maintenance  >  How to install Node.js8 on Linux

How to install Node.js8 on Linux

PHPz
PHPzforward
2023-05-15 14:55:061340browse

Node.js is an event-driven, non-blocking I/O model JavaScript runtime environment. It enables efficient web applications and server-side scripts.

In order to install Node.js 8, we need to complete the following steps:

  1. Install Node.js 8

We can Use NodeSource’s binary Linux distribution to install Node.js 8. Here are the installation steps:

  • Add Node.js PPA:

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
  • Install Node.js using apt-get :

sudo apt-get install -y nodejs
  • Confirm Node.js version:

node -v

If you have an older version of Node.js installed , you need to remove it using the following command:

sudo apt-get remove nodejs
  1. Install npm

##npm is the package manager for Node.js. To install npm, we can use the following command:

sudo apt-get install npm

  1. Install common npm packages

In Node.js, there are many commonly used npm packages Bag. Here are some commonly used npm packages:

  • express: a popular web application framework

  • mongoose: an object modeler for MongoDB

  • request: an HTTP request library

To install the above package, please use the following command:

sudo npm install -g express mongoose request

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

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete