Chongqing Dianming Technology Co. Ltd. | Node.js v14.17.0/npm 6.14.13/pm2 4.5.6/centos 7.9
Introduction of Chongqing Dianming Technology Co. Ltd.
Node.js v14.17.0/npm 6.14.13/pm2 4.5.6/centos 7.9
Node.js is a platform based on chrome JavaScript runtime, which is used to build network applications with fast response and easy expansion. The image is based on CentOS 7.9 64 bit operating system. This image is based on Alibaba cloud, with node.js v14.17.0, npmv6.14.13 and pm2v4.5.6 installed. You can quickly use this image to build your node. js application.

Server account information: The default administrator account of the CentOS system is root, and the default password is the password set by the newly purchased cloud host. If you need to reset the password, please log in to the Alibaba Cloud management console, find the left menu bar [Cloud Server ECS],Restart the instance after submission.

【system login】

Install Xshell or CRT SSH remote connection tool on local personal computer,

 

  1. npm install module

npm install module

npm install <Module Name>  Install the module to the project directory

npm install <Module Name> -g Install the module to the global

 

  1. build the project

Enter the directory where the project is located, execute cnpm install&&npm run build, and the generated package will be in the dist folder.

 

  1. Startup project
  1. The service start command is configured in the serve field of scripts in the package.json file.
  1. G

 

"scripts": {

 "serve": "vue-cli-service serve",

 "build": "vue-cli-service build",

 "lint": "vue-cli-service lint"

 },

npm run serve

 

  1. Put the static file generated by dist into the application to start

 

  1. Start by pm2 management

 

  1. npm command

npm init initialization package.josn file

npm uninstall <Module Name> Uninstall module

npm update <Module Name> Update module

npm outdated <Module Name> Check if the module is out of date

npm start start the module (this command is written in the start field of the scripts of the package.json file, you can customize the command to configure a server environment and install a series of necessary programs, if there is no configuration, the node server.js is directly started by default)

 

npm stop   Stop module

 

npm restart   restart module

 

npm --version   View npm version

 

npm ls   View the modules installed in the current directory

 

pm2 start app.js   start app project

 

pm2 list   List all process information managed by pm2

 

pm2 logs   Show all process logs

 

pm2 stop all   stop all process

 

pm2 restart all   restart all process

 

  1. package.json syntax

Name

The most important thing in package.json is the name and version fields. They are all necessary, if you don't have it you cannot install. The identifier composed of name and version is unique in the hypothesis. Changing the package should also change the version.

 

name is the name of this thing. note:

Don't put node or js in the name.

 

Version

The version must be parsed by node-semver, and it is packaged in npm's dependencies. (If you want to use it yourself, you can execute npm install semver)

 

CLICK HERE to view the detailed user guide for more information. For more information about the product, please visit the Product Page.