2013-10-29 211 views
1

我使用流星,我运行NPM安装请求来访问该库。一切似乎安装正确,但当我运行流星服务器,然后我得到以下错误。有没有关于这是为什么或如何解决它的任何文字?谢谢。流星,NPM和请求

While building the application: 
node_modules/request/node_modules/node-uuid/test/test.html:1: bad formatting in HTML template 
node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/run.js:1:15: Unexpected token ILLEGAL 
node_modules/request/node_modules/form-data/node_modules/combined-stream/test/run.js:1:15: Unexpected token ILLEGAL 

参考:

的test.html

<html> 
    <head> 
    <style> 
     div { 
     font-family: monospace; 
     font-size: 8pt; 
     } 
     div.log {color: #444;} 
     div.warn {color: #550;} 
     div.error {color: #800; font-weight: bold;} 
    </style> 
    <script src="../uuid.js"></script> 
    </head> 
    <body> 
    <script src="./test.js"></script> 
    </body> 
</html> 

run.js(相同)

#!/usr/bin/env node 
var far = require('far').create(); 

far.add(__dirname); 
far.include(/test-.*\.js$/); 

far.execute(); 
+0

test.html的外观如何? – enducat

+0

添加评论。 – user592419

+0

如果删除'style'和'script'标签会怎么样?为什么你要添加这些脚本呢?你应该把它留给Meteor。 –

回答

1

流星构建整个DOM本身,以便它通常拒绝任何脚本包含在html中的标签(但是它会在头部包含脚本,谢谢Andrew)。它也只支持车把风格的模板(现在)。

<html> 
    <head> 
    <title>Something</title> 
    </head> 
    <body> 
    {{>yourHandlebarsTemplate}} 
    </body> 
</html> 

我的建议是让你的JS和CSS定位为在你的项目根的客户端文件夹内的文件。

至于NPM要求,你将不能够:

  1. 安装它通常就像你在大多数节点项目做的,所以node_module超出/ NPM安装要求是出
  2. 访问的功能它没有Npm.require

在这一点上你有两种选择:从大气(非官方软件包存储库)添加包NPM并包括请求。或者尝试将lib放入/ packages /,然后使用Npm.require('request')。

或者,您可以使用Meteor的内置HTTP程序包(meteor add http),其功能类似于请求。

+0

太棒了,这很棒。谢谢Pent。 – user592419

+1

您可以手动添加'

0

从您的模板中删除,因为它似乎流星想要为您创建此标记时,生成模板。这应该处理test.html中的“HTML模板中的错误格式”错误。