未捕获的错误无法找到模块'./template.body.js
Meteor simple-todos tut - Step 2 - Uncaught Error Cannot find module './template.body.js
我已经创建了一个debian虚拟机,并在其中安装了meteor 1.4.2版本。
我正在制作简单的todos流星教程,火焰视图。
我已经做了几次步骤2 [;甚至到了删除和重新开始很多次的地步];我甚至直接把所有的代码放到不同的文件中。我花了好几个小时在谷歌上搜索;Git-hub和stackoverflow,并没有发现任何似乎与我的问题有关的东西。
当我在浏览器中查看应用程序时,页面是空白的…当我查看控制台时,我有以下错误代码:
Uncaught Error: Cannot find module './template.body.js'
at require (http://localhost:3000/packages/modules-runtime.js?hash=ab7e8d32b6c7b5a5fa7ae1b65e8225c4f9e30223:119:19) [this error continues with a lot more references and hashes, but I can't post more than 2 links]
如果有人能给我指出正确的方向,这样我就可以继续研究这个问题,我将非常感激。
好吧,这很奇怪…我复制了你所看到的。它发生时,你有流星运行,而做这个编码,所以它正在做实时代码更新,但模块没有被构建/包含正确。
我所做的就是停止并重新启动Meteor。
不知道为什么它不加载模块在重建和热代码推送,但你有它,这是修复。
这是我的shell,你可以看到我做了什么:
shaunst:~/workspace $ curl https://install.meteor.com/ | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 7784 0 7784 0 0 23942 0 --:--:-- --:--:-- --:--:-- 23950
Downloading Meteor distribution
######################################################################## 100.0%
Meteor 1.4.2 has been installed in your home directory (~/.meteor).
Writing a launcher script to /usr/local/bin/meteor for your convenience.
This may prompt for your password.
To get started fast:
$ meteor create ~/my_cool_app
$ cd ~/my_cool_app
$ meteor
Or see the docs at:
docs.meteor.com
shaunst:~/workspace $ meteor create simple-todos
Created a new Meteor app in 'simple-todos'.
To run your new app:
cd simple-todos
meteor
If you are new to Meteor, try some of the learning resources here:
https://www.meteor.com/learn
shaunst:~/workspace $ cd simple-todos/
shaunst:~/workspace/simple-todos $ meteor npm install
simple-todos@ /home/ubuntu/workspace/simple-todos
└─┬ meteor-node-stubs@0.2.3
├── assert@1.3.0
├─┬ browserify-zlib@0.1.4
│ └── pako@0.2.8
├─┬ buffer@4.5.1
│ ├── base64-js@1.1.2
│ ├── ieee754@1.1.6
│ └── isarray@1.0.0
├─┬ console-browserify@1.1.0
│ └── date-now@0.1.4
├── constants-browserify@1.0.0
├─┬ crypto-browserify@3.11.0
│ ├─┬ browserify-cipher@1.0.0
│ │ ├─┬ browserify-aes@1.0.6
│ │ │ ├── buffer-xor@1.0.3
│ │ │ └── cipher-base@1.0.2
│ │ ├─┬ browserify-des@1.0.0
│ │ │ ├── cipher-base@1.0.2
│ │ │ └─┬ des.js@1.0.0
│ │ │ └── minimalistic-assert@1.0.0
│ │ └── evp_bytestokey@1.0.0
│ ├─┬ browserify-sign@4.0.0
│ │ ├── bn.js@4.11.1
│ │ ├── browserify-rsa@4.0.1
│ │ ├─┬ elliptic@6.2.3
│ │ │ ├── brorand@1.0.5
│ │ │ └── hash.js@1.0.3
│ │ └─┬ parse-asn1@5.0.0
│ │ ├─┬ asn1.js@4.5.2
│ │ │ └── minimalistic-assert@1.0.0
│ │ ├─┬ browserify-aes@1.0.6
│ │ │ ├── buffer-xor@1.0.3
│ │ │ └── cipher-base@1.0.2
│ │ └── evp_bytestokey@1.0.0
│ ├─┬ create-ecdh@4.0.0
│ │ ├── bn.js@4.11.1
│ │ └─┬ elliptic@6.2.3
│ │ ├── brorand@1.0.5
│ │ └── hash.js@1.0.3
│ ├─┬ create-hash@1.1.2
│ │ ├── cipher-base@1.0.2
│ │ ├── ripemd160@1.0.1
│ │ └── sha.js@2.4.5
│ ├── create-hmac@1.1.4
│ ├─┬ diffie-hellman@5.0.2
│ │ ├── bn.js@4.11.1
│ │ └─┬ miller-rabin@4.0.0
│ │ └── brorand@1.0.5
│ ├── inherits@2.0.1
│ ├── pbkdf2@3.0.4
│ ├─┬ public-encrypt@4.0.0
│ │ ├── bn.js@4.11.1
│ │ ├── browserify-rsa@4.0.1
│ │ └─┬ parse-asn1@5.0.0
│ │ ├─┬ asn1.js@4.5.2
│ │ │ └── minimalistic-assert@1.0.0
│ │ ├─┬ browserify-aes@1.0.6
│ │ │ ├── buffer-xor@1.0.3
│ │ │ └── cipher-base@1.0.2
│ │ └── evp_bytestokey@1.0.0
│ └── randombytes@2.0.3
├── domain-browser@1.1.7
├── events@1.1.0
├─┬ http-browserify@1.7.0
│ ├── Base64@0.2.1
│ └── inherits@2.0.1
├── https-browserify@0.0.1
├── os-browserify@0.2.1
├── path-browserify@0.0.0
├── process@0.11.2
├── punycode@1.4.1
├── querystring-es3@0.2.1
├─┬ readable-stream@2.0.6
│ ├── core-util-is@1.0.2
│ ├── inherits@2.0.1
│ ├── isarray@1.0.0
│ ├── process-nextick-args@1.0.6
│ └── util-deprecate@1.0.2
├─┬ stream-browserify@2.0.1
│ └── inherits@2.0.1
├── string_decoder@0.10.31
├── timers-browserify@1.4.2
├── tty-browserify@0.0.0
├─┬ url@0.11.0
│ ├── punycode@1.3.2
│ └── querystring@0.2.0
├─┬ util@0.10.3
│ └── inherits@2.0.1
└─┬ vm-browserify@0.0.4
└── indexof@0.0.1
shaunst:~/workspace/simple-todos $ meteor --port 8080
[[[[[ ~/workspace/simple-todos ]]]]]
=> Started proxy.
=> Started MongoDB.
=> Started your app.
=> App running at: http://localhost:8080/
=> Meteor server restarted
=> Meteor server restarted
=> Meteor server restarted
=> Meteor server restarted
=> Client modified -- refreshing (x3)
=> Meteor server restarted
=> Meteor server restarted
=> Client modified -- refreshing^C
shaunst:~/workspace/simple-todos $ ^C
shaunst:~/workspace/simple-todos $ meteor --port 8080
[[[[[ ~/workspace/simple-todos ]]]]]
=> Started proxy.
=> Started MongoDB.
=> Started your app.
=> App running at: http://localhost:8080/
=> Client modified -- refreshing (x2)
我也有同样的经历。我按照用户Shaun Stoltz的建议做了(重启Meteor),它确实起作用了。但后来我在导入文件夹中添加了更多的文件,错误又出现了,现在引用的新文件缺少'template…'。
我给了Meteor另一次重启,构建再次工作。似乎流星在监视时省略了构建中的新文件。只有在重新启动时才包含新文件。这是一个真正的麻烦,因为在遵循现代组件方法时,我将创建许多小文件,并且反复重新启动Meteor将耗尽。
是否有其他用户遇到此问题?
将项目的Meteor版本设置为先前的版本:
meteor update --release 1.4.1.3
(感谢diaconutheodor)
源我在Mac上使用火焰模板运行流星。我已经完成了以下步骤,它已经工作了:
- 确保import语句在client/main.js中,而不是在服务器/main.js
- 确保'blaze-html-templates'已经安装
- 确保导入文件夹输入正确 重新启动服务器
- 如果一切都失败了,你可以使用'meteor reset'重置你的项目
- 可以't让我的if语句处理js中的html表单输入
- 使用agility.js进行页面布局和合成
- 使用Clipboard.js复制span文本
- 使用JS如何动态更改显示的html文件中的文本背景颜色
- 强制模板刷新ember.js
- 如何使用Meteor.js中的Template辅助对象迭代对象中的两个数组
- Meteor.js中Template Helper和Template Variable的区别
- Backbone.js:_.template()函数结构
- jQuery template and Backbone.js
- Reactive Template在搜索后重新渲染流星js
- 在template.phtml中使用interact.js的magento动态多维数据集
- 访问传递给Handler.js Template的上下文(或根对象)
- 未捕获的错误无法找到模块'./template.body.js
- 在underscore.js模板引擎中的Template(递归)中运行Template
- Rails ActionView::Template::Error (google_analytics.js isn
- 我们可以使用Jade Template/Js来开发Firefox扩展吗?
- Angular.js控制器"在templateUrl/template ng-click/blur/focus
- 使用gulp-angular-templatecache将HTML合并到template.js中,得到$injector
- 用mapping.fromJS和template击倒js
- Angular.js template won't show on angular-route url