Javascript: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
=Node= | =Node= | ||
==Install npx globally== | |||
<pre> | |||
nvm i -g npx | |||
nvm ls-remote | |||
nvm ls | |||
nvm use v16.16.0 | |||
</pre> | |||
=React= | |||
<pre> | |||
npx create-react-app my-app | |||
</pre> | |||
== pm2 - Run NPM as a service == | == pm2 - Run NPM as a service == | ||
* https://github.com/Unitech/pm2 | * https://github.com/Unitech/pm2 | ||
< | <pre> | ||
pm2 list | |||
pm2 start "npm run dev" --name myAppName | |||
</pre> | |||
===== pm2 examples ===== | |||
- Start and add a process to the pm2 process list: | |||
<pre> | |||
pm2 start app.js --name app | |||
</pre> | |||
- Show the process list: | |||
<pre> | |||
pm2 ls | |||
</pre> | |||
- Stop and delete a process from the pm2 process list: | |||
<pre> | |||
pm2 delete app | |||
<pre> | |||
- Stop, start and restart a process from the process list: | |||
<pre> | |||
pm2 stop app | |||
pm2 start app | |||
pm2 restart app | |||
</pre> | |||
- Clusterize an app to all CPU cores available: | |||
<pre> | |||
pm2 start -i max | |||
</pre> | |||
- Update pm2 : | |||
<pre> | <pre> | ||
npm install pm2 -g && pm2 update | |||
</pre> | </pre> | ||
- Install pm2 auto completion: | |||
<pre> | <pre> | ||
pm2 completion install | |||
</pre> | </pre> |
Latest revision as of 22:38, 25 November 2023
Node
Install npx globally
nvm i -g npx nvm ls-remote nvm ls nvm use v16.16.0
React
npx create-react-app my-app
pm2 - Run NPM as a service
pm2 list pm2 start "npm run dev" --name myAppName
pm2 examples
- Start and add a process to the pm2 process list:
pm2 start app.js --name app
- Show the process list:
pm2 ls
- Stop and delete a process from the pm2 process list:
pm2 delete app <pre> - Stop, start and restart a process from the process list: <pre> pm2 stop app pm2 start app pm2 restart app
- Clusterize an app to all CPU cores available:
pm2 start -i max
- Update pm2 :
npm install pm2 -g && pm2 update
- Install pm2 auto completion:
pm2 completion install