Nuxt.js: pm2 don't work in nuxt application

Created on 10 May 2020  路  3Comments  路  Source: nuxt/nuxt.js

Version

v2.12.1
windows 10
node v12.16.0
pm2 v4.4.0

Reproduction link

http://example.com

Steps to reproduce

pm2 start npm -- start

What is expected ?

running application

What is actually happening?

[PM2] Starting C:\PROGRAM FILES\NODEJS\NPM.CMD in fork_mode (1 instance)
[PM2] Done.
[PM2][ERROR] Script not found: D:\site.locclient\start

This bug report is available on Nuxt community (#c10636)
bug-report

Most helpful comment

I solved it like this

npm i nuxt-start

ecosystem.config.js

module.exports =
{
    apps:
    [
        {
            name: "client",
            script: "node_modules/nuxt-start/bin/nuxt-start.js",
            cwd: "/home/site/client",
            args: "start -p 80 -H 0.0.0.0"
        }
    ]
}

pm2 start ecosystem.config.js

All 3 comments

Actually same issue I just had

pm2 work with nuxtjs, from my project I add this in package.json script,

    "start": "export `cat env/.prod-env` && nuxt start",
    "ypm2": "pm2 start --name 'web' 'yarn start' ",

pm2 start --name 'web' '${or your start script}'

I solved it like this

npm i nuxt-start

ecosystem.config.js

module.exports =
{
    apps:
    [
        {
            name: "client",
            script: "node_modules/nuxt-start/bin/nuxt-start.js",
            cwd: "/home/site/client",
            args: "start -p 80 -H 0.0.0.0"
        }
    ]
}

pm2 start ecosystem.config.js

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mikekidder picture mikekidder  路  3Comments

maicong picture maicong  路  3Comments

VincentLoy picture VincentLoy  路  3Comments

gary149 picture gary149  路  3Comments

shyamchandranmec picture shyamchandranmec  路  3Comments