1

我是 Neo4j 的初学者,我尝试使用本文档中建议的代码: https ://neo4j.com/developer/javascript/

但我收到以下错误:

Neo4jError: Unknown Bolt protocol version: 0

at captureStacktrace (C:\Users\abdsheikh\Documents\NodeJSApps\DrugRepo\node_modules\neo4j-driver\lib\result.js:275:15)
at new Result (C:\Users\abdsheikh\Documents\NodeJSApps\DrugRepo\node_modules\neo4j-driver\lib\result.js:66:19)
at Session._run (C:\Users\abdsheikh\Documents\NodeJSApps\DrugRepo\node_modules\neo4j-driver\lib\session.js:172:14)
at Session.run (C:\Users\abdsheikh\Documents\NodeJSApps\DrugRepo\node_modules\neo4j-driver\lib\session.js:133:19)
at Object.<anonymous> (C:\Users\abdsheikh\Documents\NodeJSApps\DrugRepo\neo4j.js:12:33)

这是我的代码:

const neo4j = require('neo4j-driver')

uri = "bolt+s://<some-secret-url>.dbs.graphenedb.com:24787";
user = ""; //user was here
password = ""; // password was here

const driver = neo4j.driver(uri, neo4j.auth.basic(user, password))
const session = driver.session()

try {
  const resultPromise = session.run('match(c:Conditions) return c.Name');

  resultPromise.then(result => {
    session.close();
     console.log(node.properties);

    driver.close();
  }).catch((error) => {
    console.log(error);
  });

} finally {
  console.log("Bye");
}
4

2 回答 2

1

该错误表明可能不支持螺栓协议。您使用的是 Neo4j 版本 3.5.x。我认为 Neo4j 4.x 系列启用了新的 bolt+s 协议。

尝试将uri更改为:

uri = "bolt://<some-secret-url>.dbs.graphenedb.com:24787";
于 2020-06-29T21:41:10.957 回答
1

使用 GrapheneDB 在 Heroku 上运行 Neo4j 时遇到了同样的问题,我实际上不得不neo4j-driver4.1.0to降级4.0.2并使用@Tomaž Bratanič 提到的boltv1 协议。bolt://

GrapheneDB 的文档说他们目前(2020 年 6 月 15 日)4.1.0还不支持该驱动程序。

您还可以在此处找到有关使用正确bolt版本的更多信息https://github.com/neo4j/neo4j-javascript-driver/issues/595

于 2020-07-15T08:08:11.990 回答