Helloes, У меня есть модуль не найден ошибок при попытке использовать драйвер Neo4j в моем приложении с угловым 2 CLI.Ошибки при импорте Neo4j Драйвер Javascript для Angular 2 CLI
Возможно, у меня что-то не хватает, чтобы импортировать его.
- Я установил его: нг установить Neo4j-драйвера
- В моих service.ts:
import 'neo4j-driver/lib/browser/neo4j-web';
Попытка назвать этот пример кода в службе:
getFromDB(): void { var neo4j = require('neo4j-driver').v1; var driver = neo4j.driver("bolt://localhost", neo4j.auth.basic("neo4j", "pisikopat")); // Create a session to run Cypher statements in. // Note: Always make sure to close sessions when you are done using them! var session = driver.session(); // Run a Cypher statement, reading the result in a streaming manner as records arrive: session .run("OPTIONAL MATCH (source)-[r]-(target) WHERE r is not null RETURN (source)") .subscribe({ onNext: function (record) { console.log(record._fields); }, onCompleted: function() { // Completed! session.close(); }, onError: function (error) { console.log(error); } }); }
Когда я ng подавать мое приложение, я получаю следующие ошибки:
ERROR in ./~/neo4j-driver/lib/v1/internal/ch-node.js
Module not found: Error: Can't resolve 'net' in 'E:\emek\node_modules\neo4j-driver\lib\v1\internal'
@ ./~/neo4j-driver/lib/v1/internal/ch-node.js 32:11-25 364:2-24
@ ./~/neo4j-driver/lib/v1/internal/connector.js
@ ./~/neo4j-driver/lib/v1/driver.js
@ ./~/neo4j-driver/lib/v1/index.js
@ ./~/neo4j-driver/lib/index.js
@ ./src/app/services/heroes.service.ts
@ ./src/app/app.component.ts
@ ./src/app/index.ts
@ ./src/main.ts
@ multi main
ERROR in ./~/neo4j-driver/lib/v1/internal/ch-node.js
Module not found: Error: Can't resolve 'tls' in 'E:\emek\node_modules\neo4j-driver\lib\v1\internal'
@ ./~/neo4j-driver/lib/v1/internal/ch-node.js 36:11-25
@ ./~/neo4j-driver/lib/v1/internal/connector.js
@ ./~/neo4j-driver/lib/v1/driver.js
@ ./~/neo4j-driver/lib/v1/index.js
@ ./~/neo4j-driver/lib/index.js
@ ./src/app/services/heroes.service.ts
@ ./src/app/app.component.ts
@ ./src/app/index.ts
@ ./src/main.ts
@ multi main
ERROR in ./~/neo4j-driver/lib/v1/internal/ch-node.js
Module not found: Error: Can't resolve 'readline' in 'E:\emek\node_modules\neo4j-driver\lib\v1\internal'
@ ./~/neo4j-driver/lib/v1/internal/ch-node.js 92:2-21
@ ./~/neo4j-driver/lib/v1/internal/connector.js
@ ./~/neo4j-driver/lib/v1/driver.js
@ ./~/neo4j-driver/lib/v1/index.js
@ ./~/neo4j-driver/lib/index.js
@ ./src/app/services/heroes.service.ts
@ ./src/app/app.component.ts
@ ./src/app/index.ts
@ ./src/main.ts
@ multi main
угловой кли: 1.0.0-beta.15 узел: 4.5.0 ОС: win32 x64