typescript-client
typescript-client copied to clipboard
Error: Cannot find module 'graphql-request'
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
Hi @josiahbryan, thanks for raising this. I'll look into it and get back to you!
@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.
Hmm, will attempt to reproduce again and isolate. Thanks for the quick response! WiIll get back to you in next ~3 hours or so
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?
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:
- Create a fresh
package.json
file by runningnpm init
in an empty directory - Run
npm install --verbose weaviate-ts-client
- Inspect the terminal logs for any installation errors, pasting the log output here
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.
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.
same issue version 2.0.0
Not quite the same but in the same area: https://github.com/weaviate/typescript-client/issues/106