Search code examples
node.jsnuxt.jspm2

nuxt.js: where is the .js for running nuxt start


nuxt version: 2.4.3

I'm using node process manager (pm2) for my node.js hosting. To run nuxt on development server, you can simply nuxt or npm run dev but that's not the case if you're using pm2's ecosystem.config.js which needs you to specify which file actually runs that.

For example, to run a developement server I have to point to the file that runs it which is ./node_modules/nuxt/bin/nuxt.js

But I have no idea which file that run production server or nuxt start

Can someone points me which file in ./node_modules/nuxt or ./node_modules/@nuxt that perform nuxt start?

--edit This article covers how you run nuxt start with pm2 but aforementioned file ./node_modules/nuxt/bin/nuxt-start does not exists on mine. I suspect because we are using different nuxt version


Solution

  • Js file you are looking for (nuxt > 2.3)

    node_modules/nuxt/bin/nuxt.js
    

    When using pm2, I'm doing it this way (ecosystem.yml)

    apps:
    - name: client
      script: node_modules/nuxt-start/bin/nuxt-start.js
      cwd: /root/app/client
      max_memory_restart: "250M" 
      args: "start" 
    

    Notice that for production in this case I'm using nuxt-start dependency to speed up npm i.