Panav Mendiratta
Panav Mendiratta

Reputation: 1

MeteorJS not displaying anything on running application in localhost:3000

I am new to MeteorJS, and I am using Linux. As a basic newbie, I decided to stick to the tutorials on their official website. I went to follow the to-do list tutorial and selected the blaze option. At around step 6 or 7 the tutorial mentioned that you should start to see your application come together in your localhost:3000 when running it. After starting meteor and waiting for it to build the application I opened up localhost:3000. it looked like this: AppImage. I thought there was an issue with my meteor installation so I ran

meteor npm install

to check if my installation was up to date and the output was:

up to date in 12.362s

I couldn't figure out what was wrong since the terminal wasn't sending any requests either so I opened the console in my browser and was greeted by the following errors:

Uncaught Error: Cannot find module './main.html' at makeMissingError (modules-runtime.js?hash=23fe92393aa44a7b01bb53a510a9cab5fb43037c:232) at Module.resolve (modules-runtime.js?hash=23fe92393aa44a7b01bb53a510a9cab5fb43037c:238) at Module.moduleLink [as link] (modules.js?hash=20efd7567f62601be7ae21d11e21baf9bd63c715:307) at module (main.js:1) at fileEvaluate (modules-runtime.js?hash=23fe92393aa44a7b01bb53a510a9cab5fb43037c:346) at Module.require (modules-runtime.js?hash=23fe92393aa44a7b01bb53a510a9cab5fb43037c:248) at require (modules-runtime.js?hash=23fe92393aa44a7b01bb53a510a9cab5fb43037c:268) at app.js?hash=b426fd76718daefbb34707a544746de2f90dc26c:258

Is there any way to fix this?

Thanks a lot.

edit

Some of you wanted to take a look at the main HTML and js files in the client directory, so I've included them here:

main HTML and JS:

import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';

import './main.html';
import '../imports/ui/body.js';

Template.hello.onCreated(function helloOnCreated() {
  // counter starts at 0
  this.counter = new ReactiveVar(0);
});

Template.hello.helpers({
  counter() {
    return Template.instance().counter.get();
  },
});

Template.hello.events({
  'click button'(event, instance) {
    // increment the counter when button is clicked
    instance.counter.set(instance.counter.get() + 1);
  },
});
<head>
  <title>simple-todos</title>
</head>

Upvotes: 0

Views: 333

Answers (1)

Chase
Chase

Reputation: 3126

How to read the stack trace:

  • at module (main.js:1)
    • In main.js on line 1 you are trying to import your main.html file.
  • Cannot find module './main.html'
    • Your main.js file likely has a statement like import './main.html'; on the first line.
    • This means that you must not have a main.html file adjacent to your JS file and so it cannot include it in the build.

Verify spelling, case, and location of the file (what folder it belongs in). They need to be siblings in the same folder.

Upvotes: 0

Related Questions