pm2 start "npm run start" is not working on windows OS
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 43.3k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
Description
pm2 is not running npm script on windows
how do I configure pm2 to run npm scripts on windows operation system
when I run the follow command below is the error I keep getting script not found
$ pm2 start "yarn start"
[PM2][ERROR] Script not found: C:\Users\Joseph\Desktop\simple-server\yarn start
$ pm2 report
--- PM2 report ----------------------------------------------------------------
Date : Tue Aug 30 2022 16:46:43 GMT+0000 (Greenwich Mean Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version : 5.2.0
node version : 14.17.3
node path : C:/Program Files/nodejs/node
argv : C:\Program Files\nodejs\node.exe,C:\ProgramData\npm\npm\node_modules\pm2\lib\Daemon.js
argv0 : node
user : undefined
uid : N/A
gid : N/A
uptime : 141min
===============================================================================
--- CLI ----------------------------------------------------
local pm2 : 5.2.0
node version : 14.17.3
node path : C:/Program Files/nodejs/node
argv : C:\Program Files\nodejs\node.exe,C:\ProgramData\npm\npm\node_modules\pm2\bin\pm2,report
argv0 : C:\Program Files\nodejs\node.exe
user : Joseph
===============================================================================
--- System info --------------------------------------------
arch : x64
platform : win32
type : Windows_NT
cpus : Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz
cpus nb : 4
freemem : 2891911168
totalmem : 8489287680
home : C:\Users\Joseph
===============================================================================
--- PM2 list -----------------------------------------------
┌─────┬───────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
└─────┴───────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
[PM2][WARN] Current process list is not synchronized with saved list. App server differs. Type 'pm2 save' to synchronize.
===============================================================================
--- Daemon logs --------------------------------------------
C:\Users\Joseph\.pm2\pm2.log last 20 lines:
PM2 | 2022-08-30T15:15:48: PM2 log: App [index:0] starting in -fork mode-
PM2 | 2022-08-30T15:15:48: PM2 log: App [index:0] online
PM2 | 2022-08-30T15:15:51: PM2 log: App [index:0] exited with code [0] via signal [SIGINT]
PM2 | 2022-08-30T15:15:51: PM2 log: App [index:0] starting in -fork mode-
PM2 | 2022-08-30T15:15:51: PM2 log: App [index:0] online
PM2 | 2022-08-30T15:15:54: PM2 log: App [index:0] exited with code [0] via signal [SIGINT]
PM2 | 2022-08-30T15:15:54: PM2 log: App [index:0] starting in -fork mode-
PM2 | 2022-08-30T15:15:54: PM2 log: App [index:0] online
PM2 | 2022-08-30T15:15:57: PM2 log: App [index:0] exited with code [0] via signal [SIGINT]
PM2 | 2022-08-30T15:15:57: PM2 log: App [index:0] starting in -fork mode-
PM2 | 2022-08-30T15:15:57: PM2 log: App [index:0] online
PM2 | 2022-08-30T15:16:00: PM2 log: App [index:0] exited with code [0] via signal [SIGINT]
PM2 | 2022-08-30T15:16:00: PM2 log: App [index:0] starting in -fork mode-
PM2 | 2022-08-30T15:16:00: PM2 log: App [index:0] online
PM2 | 2022-08-30T15:16:04: PM2 log: App [index:0] exited with code [0] via signal [SIGINT]
PM2 | 2022-08-30T15:16:04: PM2 log: App [index:0] starting in -fork mode-
PM2 | 2022-08-30T15:16:04: PM2 log: App [index:0] online
PM2 | 2022-08-30T15:16:05: PM2 log: Stopping app:index id:0
PM2 | 2022-08-30T15:16:05: PM2 log: App [index:0] exited with code [1] via signal [SIGINT]
PM2 | 2022-08-30T15:16:05: PM2 log: pid=7312 msg=process killed
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the Windows failure with pm2 start "yarn start" and inspect the details from pm2 report. Trace how the CLI interprets a quoted package-manager command versus a script path; done means the intended npm or Yarn start command launches successfully on Windows without the reported script-not-found error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100