typescript-client icon indicating copy to clipboard operation
typescript-client copied to clipboard

Error: Cannot find module 'graphql-request'

Open josiahbryan opened this issue 1 year ago β€’ 9 comments

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

josiahbryan avatar Aug 08 '23 03:08 josiahbryan

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

tsmith023 avatar Aug 08 '23 08:08 tsmith023

@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.

tsmith023 avatar Aug 08 '23 09:08 tsmith023

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 avatar Aug 08 '23 16:08 josiahbryan

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?

josiahbryan avatar Aug 09 '23 00:08 josiahbryan

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

tsmith023 avatar Aug 09 '23 08:08 tsmith023

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.

zoranbabic avatar Sep 01 '23 13:09 zoranbabic

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.

malgamves avatar Oct 30 '23 09:10 malgamves

same issue version 2.0.0

geminigeek avatar Dec 07 '23 18:12 geminigeek

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

j-d-carmichael avatar Jan 06 '24 18:01 j-d-carmichael