簡體   English   中英

如何在 Javascript 中安裝庫“何時”

[英]How to install library 'When' in Javascript

我有 2 個文件:index.html 和 index.js。 我正在使用它們來嘗試進行高速公路通信。 高速公路可以工作,但“何時”不起作用。

我使用 bower 下載並安裝了 Autobahn,然后從 html 中手動包含 autobahn.js。 我對 When 做了同樣的事情,但是在 When 庫中出現了一個錯誤。

索引.html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Testing Autobahn</title>
</head>

<body>
<p> Fancy paragraph! </p>

<!--Bower-->
<script src="./bower_components/module/module.js"></script>
<script src="./bower_components/autobahn/autobahn/autobahn.min.js"></script>
<script src="./bower_components/when/when.js"></script>

<!--Node.js-->
<!--<script src="./node_modules/autobahn/lib/autobahn.js"></script>-->

<!--Browserify-->
<!--<script src="./bundle.js"></script>-->

<!--The actual main script file-->
<script type="text/javascript" src="index.js"></script>
</body>
</html>

當我在 web 瀏覽器中打開 index.html 時,我得到以下信息:

錯誤

找到了答案。 交易是使用 npm 安裝庫。 之后在 node-modules 文件夾中有 2 個包含庫的文件夾:1)高速公路瀏覽器 2)當

在像這樣包含它們之后,它就像一個魅力:

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM