AdonisJS keeps crashing


#1

Hello, I’m facing a weird issue where I can’t keep AdonisJS running with the command adonis serve --dev, but it somehow works with npm run start. When I run the first command, I don’t even get the info: serving app on http://127.0.0.1:3333 message, it stops instantly.

I looked at all my edited code since the last time it worked, and saw nothing problematic (no linting problem, no misssing element, nothing). And, obviously, AdonisJS doesn’t say what’s happening.

Why does npm run start works when adonis serve --dev doesn’t, and how can I troubleshoot this?

Thank you in advance


#2

Can you share the output of adonis —version?


#3

It returns 4.0.7
But my package.json file says the following:

{
  "name": "adonis-api-app",
  "version": "4.1.0",
  //... rest of the package.json file
}

#4

Can you please run the following command and then try it.

npm i -g @adonisjs/cli@latest

#5

I ran the command, now adonis --version returns 4.1.0.
However, I still have the same issue. I noticed that when I rebooted my computer, I could make the server run for a few minutes before it crashed. Is there anything cache related I can clean?


#6

This is weird. The CLI doesn’t cache anything. How about adonis serve without the --dev flag. I doubt the issue is coming from nodemon.

Also can you share the Operating system you are using


#7

I get the same exact behavior: Adonis shuts down immediatly.
I’m currently on an Ubuntu 16.04 (that I can’t upgrade because work related)
Is there any way to make Adonis a bit verbose at all?


#8

DEBUG=adonis:* adonis serve will show the debug messages


#9

That’s really weird, I got this when I ran DEBUG=adonis:* adonis serve --dev

adonis:ace parsing signature {name:Name of the project directory}{--api-only:Scaffold project for api server}{--slim:Scaffold smallest possible Adonisjs application}{--blueprint?=@value:Path to github project blueprint}{--branch?=@value:Specify git branch for project blueprint}{--skip-install:Do not install modules from npm}{--yarn:Use yarn over npm for modules installation}{--cnpm:Use cnpm over npm for installation}{--raw:Disable animations and colored output}{--dev:Install the dev release} +0ms
  adonis:ace parsing signature option name:Name of the project directory +3ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"name","description":"Name of the project directory"} +0ms
  adonis:ace parsing signature option --api-only:Scaffold project for api server +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"--api-only","description":"Scaffold project for api server"} +0ms
  adonis:ace parsing signature option --slim:Scaffold smallest possible Adonisjs application +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"--slim","description":"Scaffold smallest possible Adonisjs application"} +0ms
  adonis:ace parsing signature option --blueprint?=@value:Path to github project blueprint +0ms
  adonis:ace {"optional":true,"defaultValue":"@value","name":"--blueprint","description":"Path to github project blueprint"} +1ms
  adonis:ace parsing signature option --branch?=@value:Specify git branch for project blueprint +0ms
  adonis:ace {"optional":true,"defaultValue":"@value","name":"--branch","description":"Specify git branch for project blueprint"} +0ms
  adonis:ace parsing signature option --skip-install:Do not install modules from npm +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"--skip-install","description":"Do not install modules from npm"} +0ms
  adonis:ace parsing signature option --yarn:Use yarn over npm for modules installation +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"--yarn","description":"Use yarn over npm for modules installation"} +0ms
  adonis:ace parsing signature option --cnpm:Use cnpm over npm for installation +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"--cnpm","description":"Use cnpm over npm for installation"} +0ms
  adonis:ace parsing signature option --raw:Disable animations and colored output +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"--raw","description":"Disable animations and colored output"} +0ms
  adonis:ace parsing signature option --dev:Install the dev release +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"--dev","description":"Install the dev release"} +0ms
  adonis:ace parsing signature {name:Name of the addon directory}{--skip-install:Do not install modules from npm}{--yarn:Use yarn over npm for modules installation}{--raw:Disable animations and colored output}{--dev:Install the dev blueprint} +1ms
  adonis:ace parsing signature option name:Name of the addon directory +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"name","description":"Name of the addon directory"} +0ms
  adonis:ace parsing signature option --skip-install:Do not install modules from npm +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"--skip-install","description":"Do not install modules from npm"} +0ms
  adonis:ace parsing signature option --yarn:Use yarn over npm for modules installation +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"--yarn","description":"Use yarn over npm for modules installation"} +0ms
  adonis:ace parsing signature option --raw:Disable animations and colored output +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"--raw","description":"Disable animations and colored output"} +0ms
  adonis:ace parsing signature option --dev:Install the dev blueprint +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"--dev","description":"Install the dev blueprint"} +1ms
  adonis:ace parsing signature {module:Npm module name}{--as=@value:Name of the module, required when installing from github or local file system}{--yarn:Use yarn over npm for installation}{--cnpm:Use cnpm over npm for installation}{-s, --skip-instructions:Do not run post install instructions}{--raw:Disable animations and colored output} +0ms
  adonis:ace parsing signature option module:Npm module name +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"module","description":"Npm module name"} +0ms
  adonis:ace parsing signature option --as=@value:Name of the module, required when installing from github or local file system +0ms
  adonis:ace {"optional":false,"defaultValue":"@value","name":"--as","description":"Name of the module, required when installing from github or local file system"} +0ms
  adonis:ace parsing signature option --yarn:Use yarn over npm for installation +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"--yarn","description":"Use yarn over npm for installation"} +0ms
  adonis:ace parsing signature option --cnpm:Use cnpm over npm for installation +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"--cnpm","description":"Use cnpm over npm for installation"} +0ms
  adonis:ace parsing signature option -s, --skip-instructions:Do not run post install instructions +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"-s, --skip-instructions","description":"Do not run post install instructions"} +0ms
  adonis:ace parsing signature option --raw:Disable animations and colored output +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"--raw","description":"Disable animations and colored output"} +0ms
  adonis:ace parsing signature {--dev:Start development server}{-w, --watch=@value:A custom set of only files to watch},{-e, --ext=@value:A custom set of extensions to watch},{-i, --ignore=@value:A custom set of folders to ignore watching},{-p, --polling:Use polling to find file changes. Also required when using Docker}{--debug?=@value:Start server in debug mode} +1ms
  adonis:ace parsing signature option --dev:Start development server +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"--dev","description":"Start development server"} +0ms
  adonis:ace parsing signature option -w, --watch=@value:A custom set of only files to watch +0ms
  adonis:ace {"optional":false,"defaultValue":"@value","name":"-w, --watch","description":"A custom set of only files to watch"} +0ms
  adonis:ace parsing signature option -e, --ext=@value:A custom set of extensions to watch +0ms
  adonis:ace {"optional":false,"defaultValue":"@value","name":"-e, --ext","description":"A custom set of extensions to watch"} +0ms
  adonis:ace parsing signature option -i, --ignore=@value:A custom set of folders to ignore watching +0ms
  adonis:ace {"optional":false,"defaultValue":"@value","name":"-i, --ignore","description":"A custom set of folders to ignore watching"} +0ms
  adonis:ace parsing signature option -p, --polling:Use polling to find file changes. Also required when using Docker +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"-p, --polling","description":"Use polling to find file changes. Also required when using Docker"} +0ms
  adonis:ace parsing signature option --debug?=@value:Start server in debug mode +0ms
  adonis:ace {"optional":true,"defaultValue":"@value","name":"--debug","description":"Start server in debug mode"} +0ms
  adonis:ace parsing signature {-f, --force:Forcefully generate the key in production environment}{--env=@value:.env file location}{-s, --size=@value:The key size which defaults to 32 characters}{--echo:Echo the key instead of writing to the file} +0ms
  adonis:ace parsing signature option -f, --force:Forcefully generate the key in production environment +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"-f, --force","description":"Forcefully generate the key in production environment"} +0ms
  adonis:ace parsing signature option --env=@value:.env file location +0ms
  adonis:ace {"optional":false,"defaultValue":"@value","name":"--env","description":".env file location"} +0ms
  adonis:ace parsing signature option -s, --size=@value:The key size which defaults to 32 characters +0ms
  adonis:ace {"optional":false,"defaultValue":"@value","name":"-s, --size","description":"The key size which defaults to 32 characters"} +0ms
  adonis:ace parsing signature option --echo:Echo the key instead of writing to the file +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"--echo","description":"Echo the key instead of writing to the file"} +1ms
  adonis:ace parsing signature {name:Name of the controller}{--resource:Create resourceful methods on the controller}{--type=@value:The type can be http or ws} +0ms
  adonis:ace parsing signature option name:Name of the controller +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"name","description":"Name of the controller"} +0ms
  adonis:ace parsing signature option --resource:Create resourceful methods on the controller +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"--resource","description":"Create resourceful methods on the controller"} +0ms
  adonis:ace parsing signature option --type=@value:The type can be http or ws +0ms
  adonis:ace {"optional":false,"defaultValue":"@value","name":"--type","description":"The type can be http or ws"} +0ms
  adonis:ace parsing signature {name:Name of the model}{-m, --migration:Generate migration for the model}{-c, --controller:Generate resourceful controller for the model} +0ms
  adonis:ace parsing signature option name:Name of the model +1ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"name","description":"Name of the model"} +0ms
  adonis:ace parsing signature option -m, --migration:Generate migration for the model +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"-m, --migration","description":"Generate migration for the model"} +0ms
  adonis:ace parsing signature option -c, --controller:Generate resourceful controller for the model +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"-c, --controller","description":"Generate resourceful controller for the model"} +0ms
  adonis:ace parsing signature {name:Name of the trait} +0ms
  adonis:ace parsing signature option name:Name of the trait +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"name","description":"Name of the trait"} +0ms
  adonis:ace parsing signature {name:Name of the view}{-l, --layout=@value:Define a layout to extend} +0ms
  adonis:ace parsing signature option name:Name of the view +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"name","description":"Name of the view"} +0ms
  adonis:ace parsing signature option -l, --layout=@value:Define a layout to extend +0ms
  adonis:ace {"optional":false,"defaultValue":"@value","name":"-l, --layout","description":"Define a layout to extend"} +0ms
  adonis:ace parsing signature {name:Name of the middleware}{--type=@value:The type can be http, ws or both} +0ms
  adonis:ace parsing signature option name:Name of the middleware +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"name","description":"Name of the middleware"} +1ms
  adonis:ace parsing signature option --type=@value:The type can be http, ws or both +0ms
  adonis:ace {"optional":false,"defaultValue":"@value","name":"--type","description":"The type can be http, ws or both"} +0ms
  adonis:ace parsing signature {name:Name of the command} +0ms
  adonis:ace parsing signature option name:Name of the command +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"name","description":"Name of the command"} +0ms
  adonis:ace parsing signature {name:Name of the exception} +0ms
  adonis:ace parsing signature option name:Name of the exception +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"name","description":"Name of the exception"} +0ms
  adonis:ace parsing signature {name:Name of the hook}{-m, --method=@value:The method to be created on hook} +0ms
  adonis:ace parsing signature option name:Name of the hook +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"name","description":"Name of the hook"} +0ms
  adonis:ace parsing signature option -m, --method=@value:The method to be created on hook +0ms
  adonis:ace {"optional":false,"defaultValue":"@value","name":"-m, --method","description":"The method to be created on hook"} +1ms
  adonis:ace parsing signature {name:Name of migration file, current timestamp will be prepended to the name}{--action?=@value:Choose an action to `create` or `select` a table} +0ms
  adonis:ace parsing signature option name:Name of migration file, current timestamp will be prepended to the name +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"name","description":"Name of migration file, current timestamp will be prepended to the name"} +0ms
  adonis:ace parsing signature option --action?=@value:Choose an action to `create` or `select` a table +0ms
  adonis:ace {"optional":true,"defaultValue":"@value","name":"--action","description":"Choose an action to `create` or `select` a table"} +0ms
  adonis:ace parsing signature {name:Name of the listener}{-m, --method=@value:The method to be created on listener} +0ms
  adonis:ace parsing signature option name:Name of the listener +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"name","description":"Name of the listener"} +0ms
  adonis:ace parsing signature option -m, --method=@value:The method to be created on listener +0ms
  adonis:ace {"optional":false,"defaultValue":"@value","name":"-m, --method","description":"The method to be created on listener"} +0ms
  adonis:ace parsing signature {name:Name of the provider} +1ms
  adonis:ace parsing signature option name:Name of the provider +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"name","description":"Name of the provider"} +0ms
  adonis:ace parsing signature  +1ms
  adonis:ace parsing signature  +0ms
  adonis:ace parsing signature {name?=Database:Name of the seed file} +0ms
  adonis:ace parsing signature option name?=Database:Name of the seed file +0ms
  adonis:ace {"optional":true,"defaultValue":"Database","name":"name","description":"Name of the seed file"} +0ms
  adonis:ace parsing signature  +1ms
  adonis:ace parsing signature {directory:Directory path for which to run instructions}{--as=@value:Name of the module} +0ms
  adonis:ace parsing signature option directory:Directory path for which to run instructions +0ms
  adonis:ace {"optional":false,"defaultValue":null,"name":"directory","description":"Directory path for which to run instructions"} +0ms
  adonis:ace parsing signature option --as=@value:Name of the module +0ms
  adonis:ace {"optional":false,"defaultValue":"@value","name":"--as","description":"Name of the module"} +0ms
  adonis:cli loading ace from cli +0ms

 SERVER STARTED 
> Watching files for changes...

And it crashed right after that, without being more explicit than that.


#10

Are you sure there is nothing else killing your node process ? or using the PORT 3333 ? maybe something is killing the process, can you kill all node processes running before running adonis serve --dev ? also check for the PORT just in case. (just guessing here).

Regards.


#11

hello, what is your nodejs version also ?


#12

@pikitgb > I don’t believe so, when I reboot my PC for various reasons, I can start the node server with the command adonis serve --dev, until I “use” the serve (making an API call), and it would stop completely, resulting in “unauthorized connection” error.
If I use npm run start instead, it will work but I have to stop and restart the server at every change I make in the code, since it’s not watched.

@globalvip > I use the version 10.11.0

I tried the same stack on my personal computer (this is my office computer), and I have no problem whatsoever.


#13

After it crashes; running the command netstat tulpn is there anything on port 3333?


#14

I tried your command, I also tried with netstat -paunt (found here (sorry, it’s in french)), while I had the Adonis server shut down, and found nothing with port 3333 with any of the two commands. I even found my VueJS server twice in the list.


#15

Hello, i have already face similar beahavio. for some reason, using adonis serve --dev command don’t restart the server as it should, or sometimes when you kill and restart, some node js remain listening on default port or are not killed (Maybe your Vues server).

Try to use nodemon, not adonis serve --dev

  1. Install Nodemon

  2. configure it . for me, in my package.json file i added :

 // ...
  "main": "server.js",
  "nodemonConfig": {
    "ignore": [
      ".git",
      "test/*",
      "docs/*",
      "*.test.js",
      "fixtures/*",
      "tmp/*",
      "node_modules/*",
      "tmp/*",
      "resources/*",
      "public/*"
    ],
    "execMap": {
      "js": "node --harmony"
    },
  1. run nodemon