In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
NPM2 how to start the node.js file, I believe that many inexperienced people do not know what to do, so this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.
Install npm install-g pm2 use $npm install-g pm2 command line to install pm2 $pm2 start app.js globally or pm2 start bin/www to start the node project $pm2 stop bin/www stop the pm2 service $pm2 list lists all the process information managed by pm2 and shows how many times a process will be started because of unhandled exceptions. $pm2 monit monitors the CPU and memory usage of each node process $pm2 logs displays all process logs $pm2 stop all stops all processes $pm2 restart all restarts all processes $pm2 reload all 0 second shutdown reloads processes (for NETWORKED processes) $pm2 stop 0 stops specified processes $pm2 restart 0 restarts specified processes $pm2 startup generates init scripts to keep processes alive $pm2 web runs robust computer API endpoint ( Http://localhost:9615)$ pm2 delete 0 kills specified processes $pm2 delete all kills different ways for all processes to run processes $pm2 start app.js-I max starts 3 processes based on the number of valid CPU maximum number of processes $pm2 start app.js-I 3 start 3 processes $pm2 start app.js-x start app.js in fork mode instead of using cluster$ pm2 start app.js-x-- a 23 start app in fork mode .js and pass the parameter (- a 23) $pm2 start app.js-- name serverone starts a process and names it serverone$ pm2 stop serverone stop serverone process $pm2 start app.json start process Set the option $pm2 start app.js-I max-a 23 in app.json and pass the parameter $pm2 start app.js-I max-e err.log-o out.log to app.js after-- and generate a configuration file to boot
Install and configure pm2-windows-service
Pm2-windows-service can install pm2 into windows service to achieve the purpose of starting up and running.
Npm I-g pm2-windows-service
Add pm2 environment variable
Add the system environment variable PM2_HOME=C:\ Users\ JasonYang\ .pm2
Right-click [my computer]-[Properties]-[Advanced system Settings]-[Environment variable]-New [system variable]
Name PM2_HOME
Path C:\ Users\ JasonYang\ .pm2 (this path is based on your own needs)
Installation service
Open a new command line window with administrator privileges and execute the following command to install the service
Pm2-service-install
Perform environment setup? Select n to continue
At this point, the PM2 service has been successfully installed and started. You can view it through Wn+R. Enter services.msc to see the service.
Start the node program
Let's start our own service program app.js with pm2, and then tell pm2 to run my app.js automatically when it is turned on.
Continue under the administrator command line, cd to the directory where app.js is located
Pm2 start app.js-name myapp
View a list of services
Pm2 list
Add to self-startup service
Pm2 save
Pm2 save is important because it saves the NodeJS services currently being managed by pm2 and restores them after power on
At this point, the installation and configuration is complete
After reading the above, the uninstall service pm2-service-uninstall, have you mastered how NPM2 starts the node.js file? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.