Example: npm run start in win11, and prevent cmd.exe window popup
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 43.3k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
Description
https://github.com/Unitech/pm2/issues/3657#issuecomment-1552997822
This works for npm run start in win11, and will prevent cmd.exe window popup:
module.exports = {
apps: [
{
name: 'qq-bot',
// script: 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
// instances: 1,
// exec_mode: 'cluster',
script: 'npm',
args: 'run start',
cwd: 'D:/repo/qq-bot',
interpreter: process.platform === 'win32' && 'C:\\Windows\\System32\\cmd.exe',
},
],
};
I tried C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js with fork mode and it will popup cmd.exe.
I tried cluster mode, but it won't execute things in npm script, if that script point to a ps1 or bat shell file in node_modules/.bin
But with interpreter cmd.exe + script: 'npm' this works well.
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
No repository file or test is named. Start by reviewing the linked issue and the Windows process handling involved in npm run start, then reproduce the fork and cluster cases on Windows 11 with cmd.exe, npm-cli.js, and scripts using .ps1 or .bat files. Done should establish the supported behavior and prevent the reported cmd.exe popup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- cli, devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100