[英]Meteor, npm, and request
我正在使用流星,並且運行了npm install請求來訪問該庫。 一切似乎都正確安裝,但是當我運行流星服務器時,我得到以下錯誤。 關於這是為什么還是如何解決有什么說法嗎? 謝謝。
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();
Meteor構造了整個DOM本身,因此通常會拒絕html中包含的任何腳本標簽(但感謝Andrew,它將在頭中包含腳本)。 它還僅支持車把樣式模板(現在)。
<html>
<head>
<title>Something</title>
</head>
<body>
{{>yourHandlebarsTemplate}}
</body>
</html>
我的建議是將您的js和CSS作為文件放在項目根目錄下的client文件夾中。
對於NPM請求,您將不能:
此時,您有兩個選擇:從Atmosphere(非官方軟件包存儲庫)添加軟件包NPM,並包含請求。 或者嘗試將庫放入/ packages /,然后使用Npm.require('request')。
另外,您可以只使用Meteor內置的HTTP程序包(meteor add http),其功能類似於request。
從您的模板中刪除,因為Meteor似乎希望在構建模板時為您創建此標簽。 這應該解決test.html中的“ HTML模板格式錯誤”錯誤。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.