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 when building with TypeScript: src/node_modules/openai/_shims/node-types.d.ts:10:32 - error TS2307: Cannot find module 'node:stream/web' or its corresponding type declarations. #1241

Open
1 task done
roblframpton opened this issue Dec 24, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@roblframpton
Copy link

Confirm this is a Node library issue and not an underlying OpenAI API issue

  • This is an issue with the Node library

Describe the bug

Since version 4.62.1, when I build a TypeScript project which includes openai, I get this error message:

src/node_modules/openai/_shims/node-types.d.ts:10:32 - error TS2307: Cannot find module 'node:stream/web' or its corresponding type declarations.

10 export { ReadableStream } from 'node:stream/web';
                                  ~~~~~~~~~~~~~~~~~

Found 1 error in src/node_modules/openai/_shims/node-types.d.ts:10

It does not occur on version 4.62.0 and below.

To Reproduce

  1. Create a TypeScript project using the below tsconfig.json
  2. yarn add openai
  3. yarn build

Code snippets

My `tsconfig.json` looks like this:


{
  "compilerOptions": {
    "target": "es6",
    "module": "commonjs",
    "rootDir": "./src",
    "outDir": "./build",
    "lib": ["es2019", "dom"],
    "esModuleInterop": true,
    "resolveJsonModule": true,
    "strict": true,
    "types": ["node", "jest"]
  },
  "exclude": ["src/**/*.test.ts", "src/test/*/**", "node_modules/*/**"]
}


### OS

Ubuntu 22.04.5 LTS via WSL on Windows 11

### Node version

v18.17.1

### Library version

4.62.1
@roblframpton roblframpton added the bug Something isn't working label Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant