gpt4 book ai didi

elasticsearch - 将ElasticSearch导入Aurelia

转载 作者:行者123 更新时间:2023-12-02 23:00:42 24 4
gpt4 key购买 nike

我正在尝试在elasticsearch-js应用程序中使用Aurelia,但遇到了一些麻烦。

执行npm install elasticsearch之后,elasticsearch将安装在app/node_modules/elasticsearch下。

在我的app.js中,我尝试使用import {elasticsearch} from 'elasticsearch';将其拉入,并且在JavaScript控制台中,出现以下错误:

system.src.js:4840 GET http://localhost:9000/dist/elasticsearch.js 404 (Not Found)D @ system.src.js:4840(anonymous function) @ system.src.js:4840Promise @ shim.min.js:1847(anonymous function) @ system.src.js:4840(anonymous function) @ system.src.js:4840(anonymous function) @ system.src.js:4840(anonymous function) @ system.src.js:4840(anonymous function) @ system.src.js:4840(anonymous function) @ system.src.js:4840(anonymous function) @ system.src.js:4840(anonymous function) @ system.src.js:4840h @ shim.min.js:1773(anonymous function) @ shim.min.js:1778e @ shim.min.js:1958
aurelia-logging-console.js:62 ERROR [app-router] Error: XHR error (404 Not Found) loading http://localhost:9000/dist/elasticsearch.js(…)error @ aurelia-logging-console.js:62log @ aurelia-logging.js:36error @ aurelia-logging.js:69processResult @ aurelia-router.js:1629(anonymous function) @ aurelia-router.js:1582h @ shim.min.js:1773(anonymous function) @ shim.min.js:1778e @ shim.min.js:1958
aurelia-logging-console.js:62 ERROR [app-router] Router navigation failed, and no previous location could be restored.error @ aurelia-logging-console.js:62log @ aurelia-logging.js:36error @ aurelia-logging.js:69restorePreviousLocation @ aurelia-router.js:1671processResult @ aurelia-router.js:1632(anonymous function) @ aurelia-router.js:1582h @ shim.min.js:1773(anonymous function) @ shim.min.js:1778e @ shim.min.js:1958

然后,我将其删除并安装了 jspm install npm:elasticsearch。这将在 app\jspm_packages\npm\elasticsearch@10.1.2下安装elasticsearch。

但是,当我尝试在我的应用中使用它时,在js控制台中出现此错误:
index.js:5 Uncaught Node tls module not supported in browsers.(anonymous function) @ index.js:5(anonymous function) @ index.js:6$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ nodelibs-tls@0.1.0.js:1(anonymous function) @ nodelibs-tls@0.1.0.js:2$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ index.js:7(anonymous function) @ index.js:113$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ forever-agent@0.6.1.js:1(anonymous function) @ forever-agent@0.6.1.js:2$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ _keep_alive_agent.js:2(anonymous function) @ _keep_alive_agent.js:46$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ http.js:10(anonymous function) @ http.js:144(anonymous function) @ http.js:146$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ index.js:3(anonymous function) @ index.js:7$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ connection_pool.js:30(anonymous function) @ connection_pool.js:227(anonymous function) @ connection_pool.js:229$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ transport.js:65(anonymous function) @ transport.js:306(anonymous function) @ transport.js:308$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ client.js:3(anonymous function) @ client.js:63$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ elasticsearch.js:5(anonymous function) @ elasticsearch.js:11$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ elasticsearch@10.1.2.js:1(anonymous function) @ elasticsearch@10.1.2.js:2$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840r @ system.src.js:4840execute @ system.src.js:4840y @ system.src.js:4840x @ system.src.js:4840p @ system.src.js:4840h @ system.src.js:4840(anonymous function) @ system.src.js:4840h @ shim.min.js:1773(anonymous function) @ shim.min.js:1778e @ shim.min.js:1958
system.src.js:4840 Uncaught Uncaught Node tls module not supported in browsers.
Evaluating http://localhost:9000/jspm_packages/github/jspm/nodelibs-tls@0.1.0/index.js$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ nodelibs-tls@0.1.0.js:1(anonymous function) @ nodelibs-tls@0.1.0.js:2$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ index.js:7(anonymous function) @ index.js:113$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ forever-agent@0.6.1.js:1(anonymous function) @ forever-agent@0.6.1.js:2$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ _keep_alive_agent.js:2(anonymous function) @ _keep_alive_agent.js:46$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ http.js:10(anonymous function) @ http.js:144(anonymous function) @ http.js:146$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ index.js:3(anonymous function) @ index.js:7$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ connection_pool.js:30(anonymous function) @ connection_pool.js:227(anonymous function) @ connection_pool.js:229$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ transport.js:65(anonymous function) @ transport.js:306(anonymous function) @ transport.js:308$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ client.js:3(anonymous function) @ client.js:63$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ elasticsearch.js:5(anonymous function) @ elasticsearch.js:11$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ elasticsearch@10.1.2.js:1(anonymous function) @ elasticsearch@10.1.2.js:2$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840r @ system.src.js:4840execute @ system.src.js:4840y @ system.src.js:4840x @ system.src.js:4840p @ system.src.js:4840h @ system.src.js:4840(anonymous function) @ system.src.js:4840h @ shim.min.js:1773(anonymous function) @ shim.min.js:1778e @ shim.min.js:1958
system.src.js:4840 Uncaught Uncaught Uncaught Node tls module not supported in browsers.
Evaluating http://localhost:9000/jspm_packages/github/jspm/nodelibs-tls@0.1.0/index.js
Evaluating http://localhost:9000/jspm_packages/github/jspm/nodelibs-tls@0.1.0.js$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ index.js:7(anonymous function) @ index.js:113$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ forever-agent@0.6.1.js:1(anonymous function) @ forever-agent@0.6.1.js:2$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ _keep_alive_agent.js:2(anonymous function) @ _keep_alive_agent.js:46$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ http.js:10(anonymous function) @ http.js:144(anonymous function) @ http.js:146$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ index.js:3(anonymous function) @ index.js:7$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ connection_pool.js:30(anonymous function) @ connection_pool.js:227(anonymous function) @ connection_pool.js:229$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ transport.js:65(anonymous function) @ transport.js:306(anonymous function) @ transport.js:308$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ client.js:3(anonymous function) @ client.js:63$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ elasticsearch.js:5(anonymous function) @ elasticsearch.js:11$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ elasticsearch@10.1.2.js:1(anonymous function) @ elasticsearch@10.1.2.js:2$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840r @ system.src.js:4840execute @ system.src.js:4840y @ system.src.js:4840x @ system.src.js:4840p @ system.src.js:4840h @ system.src.js:4840(anonymous function) @ system.src.js:4840h @ shim.min.js:1773(anonymous function) @ shim.min.js:1778e @ shim.min.js:1958
system.src.js:4840 Uncaught Uncaught Uncaught Uncaught Node tls module not supported in browsers.
Evaluating http://localhost:9000/jspm_packages/github/jspm/nodelibs-tls@0.1.0/index.js
Evaluating http://localhost:9000/jspm_packages/github/jspm/nodelibs-tls@0.1.0.js
Evaluating http://localhost:9000/jspm_packages/npm/forever-agent@0.6.1/index.js$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ forever-agent@0.6.1.js:1(anonymous function) @ forever-agent@0.6.1.js:2$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ _keep_alive_agent.js:2(anonymous function) @ _keep_alive_agent.js:46$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ http.js:10(anonymous function) @ http.js:144(anonymous function) @ http.js:146$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ index.js:3(anonymous function) @ index.js:7$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ connection_pool.js:30(anonymous function) @ connection_pool.js:227(anonymous function) @ connection_pool.js:229$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ transport.js:65(anonymous function) @ transport.js:306(anonymous function) @ transport.js:308$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ client.js:3(anonymous function) @ client.js:63$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ elasticsearch.js:5(anonymous function) @ elasticsearch.js:11$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840s @ system.src.js:4840(anonymous function) @ system.src.js:4840a @ system.src.js:4840(anonymous function) @ elasticsearch@10.1.2.js:1(anonymous function) @ elasticsearch@10.1.2.js:2$ @ system.src.js:4840d.execute @ system.src.js:4840i @ system.src.js:4840r @ system.src.js:4840execute @ system.src.js:4840y @ system.src.js:4840x @ system.src.js:4840p @ system.src.js:4840h @ system.src.js:4840(anonymous function) @ system.src.js:4840h @ shim.min.js:1773(anonymous function) @ shim.min.js:1778e @ shim.min.js:1958
system.src.js:4840 Uncaught Uncaught Uncaught Uncaught Uncaught Node tls module not supported in browsers.
Evaluating http://localhost:9000/jspm_packages/github/jspm/nodelibs-tls@0.1.0/index.js
Evaluating http://localhost:9000/jspm_packages/github/jspm/nodelibs-tls@0.1.0.js
Evaluating http://localhost:9000/jspm_packages/npm/forever-agent@0.6.1/index.js
Evaluating http://localhost:9000/jspm_packages/npm/forever-agent@0.6.1.js
...

有人知道我做错了还是图书馆与Aurelia不兼容吗?

最佳答案

Here是在浏览器中使用elasticsearch.js的特殊说明。他们说:

该浏览器的

  • 版本目前处于试验阶段。
  • 他们建议使用以下方式与Bower一起安装:

    凉亭安装elasticsearch

  • 希望能帮助到你...

    关于elasticsearch - 将ElasticSearch导入Aurelia,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34796065/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com