reactjsapigithubviteoctokit

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


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?


Solution

  • 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).