The ReactJS code trying to launch a Couchbase connection and it fails.
Create new React App :
npm install -y
npm install create-react-app --save
npm install couchbase
create-react-app testconn
npm start
— Till this all is fine —
when changed the react code with CB connection for App.js
> import React, { Component } from "react";
> import "./App.css";
>
> class App extends Component {
>
> componentDidMount() {
> var couchbase = require("couchbase");
> //var async = require("async_hooks");
> var cluster = new couchbase.Cluster(
> "couchbase://<hostname>"
> );
>
> cluster.authenticate("Administrator", "password");
> var bucket = cluster.openBucket("myBucket");
> // var N1qlQuery = couchbase.N1qlQuery;
>
> // var n1ql = new couchbase.n1ql();
> }
>
> render() {
> return (
> <div>
> <h1> testing</h1>
> </div>
> );
> }
> }
>
> export default App;
Failed to compile
./node_modules/couchbase/lib/async_hooks_stub.jsModule not found: Can't resolve 'async_hooks' in 'D:\TCGIT\CBConnection\testconn\node_modules\couchbase\lib'
Even trying to add async_hooks doesn’t solve problem
I am on Windows 10 , Couchbase 2.5.6 with node jS version 8.11.3
Any pointers would be helpful . Wonder if I am missing any couchbase library .
thanks