[SOLVED] Auto server refresh suddenly stopped working in Meteor 1.8.3

In my project the automatic server refresh (normally triggered after any code change in the ‘server’ folder) suddenly stopped working. This is very inconvenient.

I have no clue what caused, nor how I can fix it. Has anyone experience with this?

I know it sounds obvious, but sometimes just starting and stopping meteor can fix it. Otherwise, if you’re not precious of anything in the dev mongo db, you could try a meteor reset

both starting / stopping or meteor reset don’t work.

I will move my code to a fresh meteor installation, that will probable help.

I tried fixing the problem by creating a new meteor project, and moving my original projects code there, but the new project won’t run because of a typescript error. Which is weird because the content, npm modules and packages are equal to the original project.

Now I am stuck on this. Does Meteor have official paid support to help out on this kind of issues?

Hi, just to say that this have just happened to me right now in meteor 1.9. Nevertheless, everything is fixed if I stop/restart meteor building process:

  1. make some edits to client and server code
  2. save all (vs code)
  3. client code refreshes / server code doesn’t
  4. have to stop (Cntrl-C) and restart building (meteor …)
  5. everything is fine again

Bye …

Thank you for the detailed explanation of the solution that worked for you. Unfortenatly, it doesn’t work for me

Ok, I nailed it down a bit further and noticed that has something to do with typescript conversion.

I did the following tests:

  • add a new .js file -> server refreshes
  • make a change to that new .js file -> server refreshes
  • add a new .ts file -> server refreshes
  • add some code to that new .ts file -> server does NOT refresh.

I have noticed before that sometimes meteor does not start due to (unreported) typescript errors.

In my current situation meteor DOES start and run without any problem (and without error notices), but like I said, it won’t restart when changes are made in typescript files. There is one exception to that: when I make a change in the main.ts file, meteor DOES restart.

I tried as well with a fresh project with some typescript files, and in that project change detection worked well, also for the typescript files.

Conclusion is that the problem has something to do with typescript compilation in certain files in my specific project, but its is unclear which files and why Meteor chokes on them on refreshing.

Note: when I compile my projects typescript files with tsc tool, there are no errors.

1 Like

I found the bug!

I found that in version 1.8.3 and higher, Meteor server does not watch changes in typescript files that are in any folder with the exact name ‘imports’ that is under the ‘server’ directory.

My project uses the imports folder because this used to be the way to tell Meteor that it should not automatically add files from this folder, but only when they imported in other files.
I was not aware that since version 1.7 Meteor has another way to handle this (which is mentioned here)

I solved my problem by simply renaming the imports folder and using the new mechanism by adding the following to package.json:

  "meteor": {
    "mainModule": {
      "client": false,
      "server": "server/main.ts"
    }
  },

Still, I think this issue should be considered a bug, so I added an issue on Github: