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

No "exports" main defined in /node_modules/gpt-token-utils/package.json #2

Open
yanqic opened this issue Apr 13, 2023 · 1 comment
Open

Comments

@yanqic
Copy link

yanqic commented Apr 13, 2023

[ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /Users/***/workspace/dev/ts/ts-utils/node_modules/gpt-token-utils/package.json

// src/openai/token.ts
import { encode, decode } from 'gpt-token-utils';

// Encode a string to a list of tokens...
const tokens = encode('Humans are strange creatures, and ever so curious too!');

// You've got a list of tokens!
console.log(tokens); // [32661, 504, 389, 6283, 8109, 11, 290, 1683, 523, 11040, 1165, 0]

// How many tokens are there?
console.log(tokens.length); // 6

// Can we decode it back to text?
console.log(decode(tokens));

how to occur the bug:

ts-node src/openai/token.ts 
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /Users/***/workspace/dev/ts/ts-utils/node_modules/gpt-token-utils/package.json
    at new NodeError (node:internal/errors:393:5)
    at throwExportsNotFound (node:internal/modules/esm/resolve:358:9)
    at packageExportsResolve (node:internal/modules/esm/resolve:612:7)
    at resolveExports (node:internal/modules/cjs/loader:529:36)
    at Function.Module._findPath (node:internal/modules/cjs/loader:569:31)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:981:27)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/Users/yanqi/Library/pnpm/global/5/.pnpm/@cspotcode+source-map-support@0.8.1/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
    at Function.Module._load (node:internal/modules/cjs/loader:841:27)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

system: MacOS 13.3
nodejs version: 18

@leamiko
Copy link

leamiko commented Apr 28, 2023

Unfortunately, I have also encountered this issue and hope that the maintainer can resolve it as soon as possible.

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

2 participants