0

我是 MeteorJS 的新手,我正在使用 Linux。作为一个基本的新手,我决定坚持他们官方网站上的教程。我按照待办事项列表教程进行操作并选择了 blaze 选项。在第 6 步或第 7 步左右,本教程提到您应该开始看到您的应用程序在运行时在 localhost:3000 中组合在一起。在启动流星并等待它构建应用程序后,我打开了 localhost:3000。它看起来像这样: AppImage。我以为我的流星安装有问题所以我跑了

meteor npm install

检查我的安装是否是最新的并且输出是:

up to date in 12.362s

我不知道出了什么问题,因为终端也没有发送任何请求,所以我在浏览器中打开了控制台,遇到了以下错误:

未捕获的错误:在 Module.resolve (modules-runtime.js?hash=23fe92393aa44a7b01bb53a510a9238fb43037) 处的 makeMissingError (modules-runtime.js?hash=23fe92393aa44a7b01bb53a510a9cab5fb43037c:232) 处找不到模块“./main.html”作为链接] (modules.js?hash=20efd7567f62601be7ae21d11e21baf9bd63c715:307) at module (main.js:1) at fileEvaluate (modules-runtime.js?hash=23fe92393aa44a7b01bb53a510a9cab5fb43037c:346) at Module. =23fe92393aa44a7b01bb53a510a9cab5fb43037c:248) at require (modules-runtime.js?hash=23fe92393aa44a7b01bb53a510a9cab5fb43037c:268) at app.js?hash=b426fd76718daefbb4824707a540947

有没有什么办法解决这一问题?

非常感谢。

编辑

有些人想看看客户端目录中的主要 HTML 和 js 文件,所以我将它们包含在此处:

主要的 HTML 和 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>

4

1 回答 1

0

如何读取堆栈跟踪:

  • at module (main.js:1)
    • main.js第 1 行,您正在尝试导入main.html文件。
  • Cannot find module './main.html'
    • 您的 main.js 文件可能有类似import './main.html';第一行的语句。
    • 这意味着main.html您的 JS 文件不能有相邻的文件,因此它不能将其包含在构建中。

验证文件的拼写、大小写和位置(它属于哪个文件夹)。他们需要是同一个文件夹中的兄弟姐妹。

于 2020-05-30T19:40:59.057 回答