Search code examples
javascriptnode.jspm2

How to start multiple node scripts with PM2


I want to run these pm2 tasks:

"pm2-frontend": "pm2 start --name frontend npm -- start",
"pm2-storybook": "pm2 start --name storybook npm -- storybook"

Which should run these two package.json scripts:

"storybook": "start-storybook -p 6006",
"start": "next start"

But, this only seems to start the start script. Is there a way to target scripts with another name than start?


Solution

  • Use the word run before you run scripts other than start.
    Start is a default script name so you can run it with npm start but storybook is not a default script so you gotta use npm run storybook