Couchbase DB Connection from React is failing

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

Hey @eldorado,

Could you run the following script and let me know what it says?
console.log(process.versions.node).

You’re Node.js doesn’t have async_hooks as if its version 8, but the version being reported must be larger than 8 to trigger it to attempt to import it, which is a bit strange.

Cheers, Brett

Hey @brett19
Looks like ReactJS App is printing undefined in Browser when I called console.log :
componentDidMount() {
console.log(“I am version- x:” + process.versions.node);
}

npm -version
5.6.0
node --version
v8.11.3
Also checked that the file exist in path : ./node_modules/couchbase/lib/async_hooks_stub.js
I have tried downgrading to couchbase 2.5.1 and still the same problem with Undefined.

npm install couchbase@2.5.1 --save

Hey @brett19 Any luck on resolving this … I am stuck now and it seems something in couchbase library is not in right place for me to refer to build the connection.
thanks