Chongqing Dianming Technology Co. Ltd. | nodejs16.5.0/npm7.19.1/pm2 5.1/centos7.9
Introduction of Chongqing Dianming Technology Co. Ltd.
nodejs16.5.0/npm7.19.1/pm2 5.1/centos7.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 v16.5.0, npmv7.19.1 and pm2v5.1 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.
  2. EG
  3.  

    "scripts": {

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

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

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

     },

    npm run serve

     

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

  6. Start by pm2 management
  7.  

  8. npm command
  9. 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

     

  10. package.json syntax
  11. 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.

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