I run the nodejs app with yarn run start
, what is the command for pm2 I should use?
pm2 yarn run start
give me an error.
My package.json
content
"scripts": {
"start": "budo main.js:dist/bundle.js --live --host 0.0.0.0",
"watch": "watchify main.js -v --debug -o dist/bundle.js",
"prep": "yarn && mkdirp dist",
"build": "browserify main.js -o dist/bundle.js",
"lint": "eslint main.js --fix",
"deploy": "yarn build && uglifyjs dist/bundle.js -c -m -o dist/bundle.min.js"
},
The error you're getting is because a bash script (yarn) is being executed with node...
Because pm2's default interpreter is set to node.
To run yarn you'll have to set the interpreter to bash:
shell:
Try the command below:
pm2 start yarn --interpreter bash --name api -- start