Error "Script not found" when running `pm2 start npm -- start`
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 43.3k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
Description
What's going wrong?
When trying to run a Next.js based site via PM2 through an npm script, the error above is thrown. See output below:
PS C:\Users\Me\Desktop\MyApp> pm2 start npm --name "app" -- start
[PM2] Starting C:\PROGRAM FILES\NODEJS\NPM.CMD in fork_mode (1 instance)
[PM2] Done.
[PM2][ERROR] Script not found: C:\Users\Me\Desktop\MyApp\start
How could we reproduce this issue?
package.json
{
"scripts": {
"start": "next build && next start -p $PORT"
},
}
Command:
pm2 start npm --name "app" -- start
Supporting information
OS: Windows 10
NPM Path:
C:\Program Files\nodejs\npm
C:\Program Files\nodejs\npm.cmd
C:\Users\Me\AppData\Roaming\npm\npm
C:\Users\Me\AppData\Roaming\npm\npm.cmd
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 issue on Windows 10 with the supplied package.json and pm2 start npm --name "app" -- start command. Start by tracing how PM2 resolves npm.cmd and forwards the start argument, using report.txt and the reported npm paths as evidence. Done means the command starts the npm script without a "Script not found" error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, next.js, nodejs
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100