The default tutorial not working

I also ran into this same problem, my main.js file in the SERVER folder was wrong.

Even though the docs clearly state that the main.js file needs to be updated, somehow this seems to be a sticking point… it’s probably because there’s also main.js file in the CLIENT folder, which makes complete sense. But for whatever reason this seems to be catching people. I glossed over the main.js code because mentally I had “already updated” that file.

As an instructor myself, sometimes I find that I have to update tutorials / materials so that students can get past common snags in the lesson. It would be nice if Meteor put in a small flag to alert people like myself who don’t read ( lol ) to be sure to make sure that the client and server side files with the same names are respectively updated with the correct code in each instance.

Overall this is a great tutorial and Meteor is incredibly easy to use and intuitive. Respect to the team.

It would be helpful to read the initial parts of the Meteor Guide, especially Application Structure which indicates:

It is recommended that you create exactly two eagerly loaded files, client/main.js and server/main.js, in order to define explicit entry points for both the client and the server.

I had the same problem, looks like everyone changes the client/main.js instead of server/main.js

I made this mistake as well. I had took a close look at the tutorial and it is very clear. Glad this thread is in the forums.

1 Like

The same mistake, I added the line into main.js in client directory , not in server directory.
Maybe a note to beware of this common error into tutorial ? We are newbies :wink: and it is very possible we has not been working in frontend and backend same time before (I come from PHP world )

Thanks man , I had some code in client/main.js instead of the server/main.js .

Thanks, ( import ‘…/imports/api/tasks.js’; ) in server/main.js instead of client/main.js fix it.

1 Like

I did the same thing because I mistakenly put the code in the client/main.js rather than server/main.js.

This is a very easy mistake to make and therefore I would suggest that the tutorial point it out explicitly with something like: Note that the database can only be created on the server and therefore this code is in server/main.js.

This was very confusing for me as well. Added it into the wrong file. Makes sense to put it in the server files though, dunno why I did not think of that…