2013-10-29 183 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模板中的錯誤格式」錯誤。