opensearch-project / opensearch-js

Node.js Client for OpenSearch
https://opensearch.org/docs/latest/clients/javascript/
Apache License 2.0
185 stars 120 forks source link

[BUG] Module not found: Error: Can't resolve 'v8' #327

Open giusecagliari opened 1 year ago

giusecagliari commented 1 year ago

What is the bug?

_module v8 not found when call Client

How can one reproduce the bug?

yarn start

What is the expected behavior?

_client connection not working

What is your host/environment?

_ubuntu x64

Do you have any screenshots?

If applicable, add screenshots to help explain your problem.

Do you have any additional context?

  ERROR in /home/giuseppe/git/OpenSearch-Dashboards/node_modules/@opensearch-project/opensearch/lib/Transport.js
       │          Module not found: Error: Can't resolve 'v8' in '/home/giuseppe/git/OpenSearch-Dashboards/node_modules/@opensearch-project/opensearch/lib'
       │          resolve 'v8' in '/home/giuseppe/git/OpenSearch-Dashboards/node_modules/@opensearch-project/opensearch/lib'
       │            Parsed request is a module
       │            using description file: /home/giuseppe/git/OpenSearch-Dashboards/node_modules/@opensearch-project/opensearch/package.json (relative path: ./lib)
       │              Field 'browser' doesn't contain a valid alias configuration
       │              resolve as module
dblock commented 1 year ago

What is your version of node.js?

mnj95 commented 1 year ago

Experiencing the same issue in React.

./node_modules/@opensearch-project/opensearch/lib/Transport.js
Module not found: Can't resolve 'v8' in '/Users/noor/Documents/GitHub/internal-dashboard/node_modules/@opensearch-project/opensearch/lib'
wbeckler commented 1 year ago

This looks like an error in running the dashboard. Is that right?

kavilla commented 1 year ago

I think @dblock question is probably the key. The v8 module was included when adding the circuit breaker stuff: https://github.com/opensearch-project/opensearch-js/pull/207/files

spalberg commented 1 year ago

The dependency on the v8 module also makes it impossible to run opensearch-js using Deno since the memory api of v8 in Deno throws NotImplemented exceptions.

nhtruong commented 1 year ago

@giusecagliari @spalberg @mnj95 Are your apps written in TypeScript or JavaScript?

spalberg commented 1 year ago

@giusecagliari @spalberg @mnj95 Are your apps written in TypeScript or JavaScript?

TypeScript (with Deno, not NodeJS).

nhtruong commented 1 year ago

@spalberg Thanks for verifying that. It makes sense now. It's a Deno compatibility issue. v8 is a built-in module of NodeJS. There's a workaround where you can load NodeJS built-in modules in Deno, but unfortunately, v8 compatibility for Deno has not been implemented yet.

@giusecagliari and @mnj95 Are you also using a different JS runtime from NodeJS? If you're using NodeJS, which version is it?

sakrlog commented 5 months ago

Using javascript, react and webpack here, running into the same issue