【问题标题】:nuxt pm2-runtime No pages directory foundnuxt pm2-runtime 找不到页面目录
【发布时间】:2020-11-16 17:43:02
【问题描述】:

我已经创建了一个标准的 nuxt 项目 (npx create-nuxt-app),并希望使用 pm2-runtime 在服务器上部署它。我有node v10.16.0npm 6.9.0。所以我按照nuxt网站上的文档:https://nuxtjs.org/faq/deployment-pm2

首先我运行npm run build,然后我运行pm2-runtime ecosystem.config.js。我收到的问题如下:

ℹ Preparing project for development                                                                                                                                                                                                       13:33:36
ℹ Initial build may take a while                                                                                                                                                                                                          13:33:36
ERROR  No pages directory found in /Users/Sites/nuxtapp/ecosystem.config.js. Did you mean to run nuxt in the parent (../) directory?                                                                                13:33:36
  at Builder.validatePages (node_modules/@nuxt/builder/dist/builder.js:5653:13)

我的ecosystem.config.js如下:

module.exports = {
    apps: [
        {
            name: 'nuxtapp',
            exec_mode: 'cluster',
            cwd: './',
            instances: 'max',
            script: './node_modules/nuxt/bin/nuxt.js',
            args: 'start',
        },
    ],
}

我在这里做错了什么?

【问题讨论】:

  • 你用docker标记了这个; Docker是否以某种方式参与其中?例如,这是在 Dockerfile 的上下文中吗? (如果是你需要确保你COPY把所有需要的文件都放到了图片中。)
  • 我用 docker 标记了它,因为 pm2-runtime 是为 docker 创建的。但是,在不涉及 docker 的情况下也会出现问题
  • 如果您在非 dockerized 环境中运行应用程序,则可以使用 pm2。其中pm2-runtime 并不意味着它只能与 docker 一起使用。它只是在前台运行应用程序。
  • 是的,我同意,因此错误仍然是一个问题。有什么建议吗?

标签: docker nuxt.js pm2


【解决方案1】:

想通了。解决方案是在nuxt.config.js 中添加rootDir: __dirname

【讨论】:

    猜你喜欢
    • 2019-02-03
    • 2018-10-04
    • 2021-01-12
    • 1970-01-01
    • 2019-03-03
    • 1970-01-01
    • 2019-05-26
    • 2021-06-01
    • 2020-12-05
    相关资源
    最近更新 更多