Closed vforv closed 1 year ago
Mine looks like
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './chains' is not defined by "exports" in /Users/ayalpani/dev/playground/node_modules/langchain/package.json
Mine looks like
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './chains' is not defined by "exports" in /Users/ayalpani/dev/playground/node_modules/langchain/package.json
I'm also seeing this: Error: Package subpath './llms' is not defined by "exports" in <PATH>/node_modules/langchain/package.json
Looks like https://github.com/hwchase17/langchainjs/issues/185 (response there)
still not working with Typescript, even added { "type": "module" } in packages.json, and running on NodeJS v8
Inline imports should fix this issue. Fx:
Before
import {VectorDBQAChain} from 'langchain/chains';
After
const {VectorDBQAChain} = await import('langchain/chains');
I am still facing this issue without a resolve. Unfortunately solution form @AuriDeimantasDev did not work for me. Facing the same error:
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './embeddings' is not defined by "exports" in /Users/danil/Coding/shepherd-app/goldengate/node_modules/langchain/package.json
at new NodeError (node:internal/errors:372:5)
at throwExportsNotFound (node:internal/modules/esm/resolve:440:9)
at packageExportsResolve (node:internal/modules/esm/resolve:664:7)
at resolveExports (node:internal/modules/cjs/loader:483:36)
at Function.Module._findPath (node:internal/modules/cjs/loader:523:31)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:925:27)
at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/Users/danil/Coding/shepherd-app/goldengate/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
at Function.Module._load (node:internal/modules/cjs/loader:780:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
Mine looks like
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './chains' is not defined by "exports" in /Users/ayalpani/dev/playground/node_modules/langchain/package.json
I'm also seeing this:
Error: Package subpath './llms' is not defined by "exports" in <PATH>/node_modules/langchain/package.json
I got the same error then checked again requirements for typescript here and it says:
{
"compilerOptions": {
...
"target": "ES2020", // or higher
"module": "nodenext",
}
}
Updated my tsconfig.json then updated my package.json to add
{
"name": "functions",
"type": "module", <-- this
...
}
Then it worked
have performed both fixes mentioned above and still no dice, receiving:
Error: Must use import to load ES Module: /Users/lukebechtel/localdev/lib/apps/scripts/src/agents/simple-notion-agent.ts
Hi, we've released a new version 0.0.49 which adds a CJS build and should fix this issue.
If anyone is still stuck on this, make sure that you are explicitly stating "type": "commonjs"
in package.json and "module": "CommonJS"
in your tsconfig to use the CJS build. Otherwise it'll keep looking at the ESM one and erroring :)
I tried also deleting package.json but it just create new error