Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependencies are not installed with npm i langchain and resolution-mode issue #2879

Closed
sivadassilpa opened this issue Oct 11, 2023 · 2 comments
Labels
auto:bug Related to a bug, vulnerability, unexpected error with an existing feature

Comments

@sivadassilpa
Copy link

@dosu-bot

I have an issue like this
`Starting compilation in watch mode...

node_modules/langchain/dist/document_loaders/fs/buffer.d.ts:1:23 - error TS1452: 'resolution-mode' assertions are only supported when moduleResolution is node16 or nodenext.

1 ///


node_modules/langchain/dist/document_loaders/fs/buffer.d.ts:2:23 - error TS1452: 'resolution-mode' assertions are only supported when moduleResolution is node16 or nodenext.

2 ///

node_modules/langchain/dist/document_loaders/fs/directory.d.ts:1:23 - error TS1452: 'resolution-mode' assertions are only supported when moduleResolution is node16 or nodenext.

1 ///


node_modules/langchain/dist/document_loaders/fs/directory.d.ts:2:23 - error TS1452: 'resolution-mode' assertions are only supported when moduleResolution is node16 or nodenext.

2 ///

node_modules/langchain/dist/document_loaders/fs/pdf.d.ts:1:22 - error TS6053: File 'C:/Users/CibusCell/Desktop/work/cibuscell-dashboard-api/node_modules/langchain/src/types/pdf-parse.d.ts' not found.

1 ///


node_modules/langchain/dist/document_loaders/fs/pdf.d.ts:2:23 - error TS1452: 'resolution-mode' assertions are only supported when moduleResolution is node16 or nodenext.

2 ///
~~~~

node_modules/langchain/dist/document_loaders/fs/pdf.d.ts:15:32 - error TS2307: Cannot find module 'pdf-parse/lib/pdf.js/v1.10.100/build/pdf.js' or its corresponding type declarations.

15 getDocument: typeof import("pdf-parse/lib/pdf.js/v1.10.100/build/pdf.js").getDocument;

node_modules/langchain/dist/document_loaders/fs/text.d.ts:1:23 - error TS1452: 'resolution-mode' assertions are only supported when moduleResolution is node16 or nodenext.

1 ///


node_modules/langchain/dist/embeddings/cohere.d.ts:50:31 - error TS2307: Cannot find module 'cohere-ai' or its corresponding type declarations.

50 cohere: typeof import("cohere-ai");

node_modules/langchain/dist/llms/cohere.d.ts:31:31 - error TS2307: Cannot find module 'cohere-ai' or its corresponding type declarations.

31 cohere: typeof import("cohere-ai");


node_modules/langchain/dist/llms/hf.d.ts:37:36 - error TS2307: Cannot find module '@huggingface/inference' or its corresponding type declarations.

37 HfInference: typeof import("@huggingface/inference").HfInference;

node_modules/langchain/dist/llms/replicate.d.ts:23:34 - error TS2307: Cannot find module 'replicate' or its corresponding type declarations.

23 Replicate: typeof import("replicate").default;


node_modules/langchain/dist/vectorstores/chroma.d.ts:1:64 - error TS2307: Cannot find module 'chromadb' or its corresponding type declarations.

1 import type { ChromaClient as ChromaClientT, Collection } from "chromadb";
~~~~~~~~~~

node_modules/langchain/dist/vectorstores/chroma.d.ts:2:28 - error TS2307: Cannot find module 'chromadb/dist/main/types.js' or its corresponding type declarations.

2 import type { Where } from "chromadb/dist/main/types.js";

node_modules/langchain/dist/vectorstores/pinecone.d.ts:5:46 - error TS2307: Cannot find module '@pinecone-database/pinecone' or its corresponding type declarations.

5 type VectorOperationsApi = ReturnType<import("@pinecone-database/pinecone").PineconeClient["Index"]>;


node_modules/langchain/dist/vectorstores/supabase.d.ts:1:37 - error TS2307: Cannot find module '@supabase/supabase-js' or its corresponding type declarations.

1 import type { SupabaseClient } from "@supabase/supabase-js";
~~~~~~~~~~~~~~~~~~~~~~~

node_modules/langchain/dist/vectorstores/supabase.d.ts:2:45 - error TS2307: Cannot find module '@supabase/postgrest-js' or its corresponding type declarations.

2 import type { PostgrestFilterBuilder } from "@supabase/postgrest-js";
~~~~~~~~~~~~~~~~~~~~~~~~
My tsconfig.json is {
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"target": "es2017",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true,
}
}
`
Any idea how to resolve this???
@dosubot dosubot bot added the auto:bug Related to a bug, vulnerability, unexpected error with an existing feature label Oct 11, 2023
@dosubot
Copy link

dosubot bot commented Oct 11, 2023

🤖

Hello,

The errors you're encountering seem to be related to the TypeScript configuration and missing dependencies in your project. Here are some steps you can take to resolve these issues:

  1. Update your TypeScript configuration: The 'resolution-mode' assertions are only supported when moduleResolution is node16 or nodenext. You can add "moduleResolution": "node16" to your tsconfig.json file.

  2. Install missing dependencies: The errors indicate that certain modules cannot be found. These modules are likely peer dependencies of langchainjs that need to be installed separately. You can install these dependencies using npm or yarn. For example:

npm install [email protected]
npm install chromadb
npm install @huggingface/inference
npm install replicate
npm install @supabase/supabase-js
npm install @supabase/postgrest-js
  1. Skip library type checking: You can add "skipLibCheck": true to your tsconfig.json file. This will skip type checking of all declaration files (*.d.ts).

  2. Ensure you have the latest version of langchainjs installed: Uninstall the current version using npm uninstall langchain and then reinstall it using npm install -S langchain.

  3. Use Yarn for dependency management: The langchainjs project is configured to use Yarn as its package manager. If you're not already using Yarn, you can install it with npm install -g yarn and then run yarn install to install the project dependencies.

  4. Ensure you're using the correct Node.js version: The minimum required version of Node.js for the langchainjs repository is 20. You can check your Node.js version with node -v and update it if necessary.

Please try these steps and let me know if you're still encountering issues.

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@sivadassilpa
Copy link
Author

It was solved when i added "skipLibCheck": true to my tsconfig and I deleted the tsconfi.eslint.json file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:bug Related to a bug, vulnerability, unexpected error with an existing feature
Projects
None yet
Development

No branches or pull requests

1 participant