nuxt pm2-runtime No pages directory found

Viewed 1147

I have created a standard nuxt project (npx create-nuxt-app) and want to deploy it on the server with pm2-runtime. I have node v10.16.0 and npm 6.9.0. So I followed the documentation on the nuxt site: https://nuxtjs.org/faq/deployment-pm2

First I run npm run build, then I run pm2-runtime ecosystem.config.js. The problem I receive is the following:

ℹ 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)

My ecosystem.config.js is as following:

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

What am I doing wrong here?

1 Answers

Figured it out. The solution was adding rootDir: __dirname in nuxt.config.js

Related