node.js - 命令 `PM2` 的 `yarn run start` 是什么?

标签 node.js yarnpkg pm2

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

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)正在使用 Node 执行...

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

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

外壳:

尝试以下命令:

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

关于node.js - 命令 `PM2` 的 `yarn run start` 是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59046837/

相关文章:

typescript - 错误 : Qualified path resolution failed - none of the candidates can be found on the disk

node.js - Nodejs 与 koa 和 Mongo - MongooseError : You can not `mongoose.connect()` multiple times while connected

node.js - firebase 函数 :hosting gives error: time to go build something extraordinary

javascript - 仅当 mongoDB Node JS 上存在集合时才显示给客户端

npm - Yarn(或npm)用fork交换嵌套的依赖关系

javascript - pm2崩溃后重启node.js

ubuntu - 部署后如何强制 PM2 更新我的 meteor 应用程序服务器端?

mysql - Node.js:无法调用未定义的方法释放(MySql)

javascript - Node - 使用在同一文件中导出的函数

ruby-on-rails - 我如何在 Ruby 中使用乐观主义者?