无法在javascript中建立neo4j - bolt驱动程序连接 [英] Unable to establish a neo4j - bolt driver connection in javascript
问题描述
我试图通过在Chrome中运行index.html来在我的html嵌入式javascript和我的neo4j数据库之间建立连接。我已将问题的根源减少为'neo4j'未被识别。因此抛出的错误将是以下类型:
I am trying to create a connection between my html embedded javascript and my neo4j database by running the index.html in Chrome. I have reduced the source of the problem to 'neo4j' not being recognised. So the error thrown will be of the type:
无法读取未定义的属性['driver'/'basic'/ etc ...]。
Cannot read property ['driver'/'basic'/etc...] of undefined.
在这种情况下,我假设'undefined'指的是'neo4j',这意味着我没有正确实现'neo4j-web.min.js' 。
In this case I have assumed that 'undefined' is referring to 'neo4j', which would mean that I am not implementing 'neo4j-web.min.js' correctly.
下面的代码块是从我的index.html中提取出来的,取自: https://www.npmjs.com/package/neo4j-driver
The below block of code is extracted from my index.html and has been taken from: https://www.npmjs.com/package/neo4j-driver
<script src="node_modules/neo4j-driver/lib/browser/neo4j-web.min.js"></script>
<script type="text/javascript" charset="utf-8">
var driver = neo4j.driver("bolt://localhost:7474", neo4j.auth.basic(neo4j,
neo4j));
</script>
鉴于此问题看起来非常本地化,我将文件的其余部分放在一边。如果缺少进一步的上下文,我很乐意提供它。
Given that the issue seems very localised to this code, I spared everyone the rest of the document. If further context is missing, I'd be happy to provide it.
推荐答案
neo4j-driver模块使用一个奇怪的系统你必须指定你想要使用哪个版本的API。
The neo4j-driver module uses an odd system whereby you have to specify which version of the API you want to use.
<script src="node_modules/neo4j-driver/lib/browser/neo4j-web.min.js"></script>
<script type="text/javascript" charset="utf-8">
neo4j = neo4j.v1
var driver = neo4j.driver("bolt://localhost:7474", neo4j.auth.basic(neo4j,
neo4j));
</script>
这篇关于无法在javascript中建立neo4j - bolt驱动程序连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!