pm2 启动 nuxtjs 项目

1. 全局安装 pm2

sudo npm i -g pm2

2. 创建配置文件 server.json

{
  "name": "your-project-name",
  "script": "build/main.js",
  "cwd": "./",
  "watch": [
  ],
  "ignore_watch": [
      "node_modules",
      "logs"
  ],
  "watch_options": {
      "followSymlinks": false
  },
  "error_file": "./logs/app-err.log",
  "out_file": "./logs/app-out.log",
  "env": {
      "NODE_ENV": "production"
  }
}

3.修改 package.json

  "scripts": {
    "pm2": "cross-env pm2 start server.json",

4. 运行

npm run pm2

你可能感兴趣的:(pm2 启动 nuxtjs 项目)