weaviate / typescript-client

Official Weaviate TypeScript Client
https://www.npmjs.com/package/weaviate-client
BSD 3-Clause "New" or "Revised" License
57 stars 21 forks source link

Error: Cannot find module 'graphql-request' #82

Open josiahbryan opened 10 months ago

josiahbryan commented 10 months ago

Error on fresh install of "weaviate-ts-client": "^1.4.0", - it's unusable:

/Users/josiahbryan/devel/rubber/backend/node_modules/weaviate-ts-client/dist/index.js:1
Error: Cannot find module 'graphql-request'
Require stack:
- /Users/josiahbryan/devel/rubber/backend/node_modules/weaviate-ts-client/dist/index.js
- /Users/josiahbryan/devel/rubber/backend/src/services/chatbot/utils/graph/node-indexer.js
    at Object.<anonymous> (/Users/josiahbryan/devel/rubber/backend/node_modules/weaviate-ts-client/dist/index.js:1)
    at Generator.next (<anonymous>) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/josiahbryan/devel/rubber/backend/node_modules/weaviate-ts-client/dist/index.js',
    '/Users/josiahbryan/devel/rubber/backend/src/services/chatbot/utils/graph/node-indexer.js'
  ]
}

Node.js v20.5.0
tsmith023 commented 10 months ago

Hi @josiahbryan, thanks for raising this. I'll look into it and get back to you!

tsmith023 commented 10 months ago

@josiahbryan, I have setup and installed fresh versions of your Node version and the latest client on my Windows and Mac machines without issue! The current CI tests the package's functionality on ubuntu also.

If you are able, a more comprehensive MRE would be helpful to diagnose the problem you're facing.

josiahbryan commented 10 months ago

Hmm, will attempt to reproduce again and isolate. Thanks for the quick response! WiIll get back to you in next ~3 hours or so

josiahbryan commented 10 months ago

Looks like I needed to manually install deps graphql and graphql-request - is that expected that I have those installed in my project even though I don't use them, but this lib does?

tsmith023 commented 10 months ago

No, that's quite unexpected since such dependencies should be private and are not peer dependencies! I only ran npm install weaviate-ts-client in my empty package.json file without issues πŸ€”

My guess is that you may have some machine-specific global configuration of npm specified in your .npmrc file that is affecting the installation process. If this is not the case, then we can troubleshoot otherwise if you replicate the installation process with verbose logging:

  1. Create a fresh package.json file by running npm init in an empty directory
  2. Run npm install --verbose weaviate-ts-client
  3. Inspect the terminal logs for any installation errors, pasting the log output here
zoranbabic commented 10 months ago

I ran into a similar issue. We are using pnpm in our project, which doesn't install peer dependencies automatically. The weaviate SDK package has a dependency to graphql-request which has a peer dependency to graphql. After installing weaviate-ts-client I received this warning:

WARN  Issues with peer dependencies found
packages/search
└─┬ weaviate-ts-client 1.5.0
  └─┬ graphql-request 5.2.0
    β”œβ”€β”€ βœ• missing peer graphql@"14 - 16"
    └─┬ @graphql-typed-document-node/core 3.2.0
      └── βœ• missing peer graphql@"^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
Peer dependencies that should be installed:
  graphql@">=14.0.0 <15.0.0 || >=15.0.0 <16.0.0 || >=16.0.0 <17.0.0"  

The SDK of course wouldn't work and complain: Error: Cannot find module 'graphql' - until I installed graphql manually.

malgamves commented 8 months ago

I use yarn and had the same issue, installing graphql fixed it

The SDK of course wouldn't work and complain: Error: Cannot find module 'graphql' - until I installed graphql manually.

geminigeek commented 6 months ago

same issue version 2.0.0

j-d-carmichael commented 5 months ago

Not quite the same but in the same area: https://github.com/weaviate/typescript-client/issues/106