命令“yarn run start"的“PM2"是什么? [英] What is the `PM2` for command `yarn run start`?

查看:108
本文介绍了命令“yarn run start"的“PM2"是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 yarn run start 运行 nodejs 应用程序,我应该使用的 pm2 命令是什么?

I run the nodejs app with yarn run start , what is the command for pm2 I should use?

pm2 yarn run start 报错.

我的package.json 内容

"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"
  },

推荐答案

你得到的错误是因为一个 bash 脚本 (yarn) 正在与节点一起执行...

The error you're getting is because a bash script (yarn) is being executed with node...

因为 pm2 的默认解释器设置为 node.

Because pm2's default interpreter is set to node.

要运行 yarn,您必须将解释器设置为 bash:

To run yarn you'll have to set the interpreter to bash:

外壳:

试试下面的命令:

pm2 start yarn --interpreter bash --name api -- start

这篇关于命令“yarn run start"的“PM2"是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆