You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[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
The text was updated successfully, but these errors were encountered:
[ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /Users/***/workspace/dev/ts/ts-utils/node_modules/gpt-token-utils/package.json
how to occur the bug:
system: MacOS 13.3
nodejs version: 18
The text was updated successfully, but these errors were encountered: