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

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /node_modules/@nomic-ai/atlas/package.json #70

Open
jonknyc opened this issue Sep 6, 2024 · 1 comment

Comments

@jonknyc
Copy link

jonknyc commented Sep 6, 2024

I am trying out this SDK as follows:

import { embed } from "@nomic-ai/atlas"

if (!process.env.NOMIC_API_KEY) {
  throw new Error("NOMIC_API_KEY is required")
}

export async function getNomicTextEmbeddings(input: string[]) {
  const result = await embed(
    input,
    {
      model: "nomic-embed-text-v1.5",
    },
    process.env.NOMIC_API_KEY,
  )
  return result
}

getNomicTextEmbeddings(["Hello world!"]).then(console.log)

but I'm getting the following error:

> tsx --require dotenv/config lib/nomic.ts

node:internal/modules/esm/resolve:302
  return new ERR_PACKAGE_PATH_NOT_EXPORTED(
         ^

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /Users/jonk/celebrate/node_modules/@nomic-ai/atlas/package.json
    at exportsNotFound (node:internal/modules/esm/resolve:302:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:592:13)
    at resolveExports (node:internal/modules/cjs/loader:596:36)
    at Module._findPath (node:internal/modules/cjs/loader:673:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1135:27)
    at resolve (/Users/jonk/celebrate/node_modules/tsx/dist/register-CCR7NebB.cjs:2:554)
    at resolveRequest (/Users/jonk/celebrate/node_modules/tsx/dist/register-CCR7NebB.cjs:1:2758)
    at /Users/jonk/celebrate/node_modules/tsx/dist/register-CCR7NebB.cjs:2:583
    at m._resolveFilename (file:///Users/jonk/celebrate/node_modules/tsx/dist/register-Cehy_bZS.mjs:1:789)
    at Module._load (node:internal/modules/cjs/loader:990:27) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

Node.js v21.6.0

it seems like perhaps the ts-nomic library needs to be updated - any ideas?

@jonknyc
Copy link
Author

jonknyc commented Sep 9, 2024

FYI: As a short-term workaround, I am able to get it to work by importing through node-modules directly:

import { embed } from "@/node_modules/@nomic-ai/atlas/dist/embedding.js"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant