Uncaught TypeError: import_stream.default.Readable is undefined using package @octokit/core

240 Views Asked by At

I'm trying to set up a environment that allows me to interact with github apis in React - Vite using @octokit/core.

I'm importing octokit in my file:

import { Octokit } from "@octokit/core";

And when I start my application using Vite I have an error message in the console: Uncaught TypeError: import_stream.default.Readable is undefined.

Do you know what I'm doing wrong?

1

There are 1 best solutions below

0
Tim Needham On BEST ANSWER

I hit this today too... following this answer helped me. For the error you have, this part specifically helped shift it:

export default defineConfig({
  resolve: {
    alias: {
      'node-fetch': 'isomorphic-fetch',
    },
  },
})

(though in my case I was already using Axios, so used that instead of isomorphic-fetch).