Error: Module "stream" has been externalized for browser compatibility and cannot be accessed in client code
See original GitHub issueDescribe the bug When using Vite with Vue, I got this error when importing the Notion-Client.
Error: Module "stream" has been externalized for browser compatibility and cannot be accessed in client code.
To Reproduce Node version: 16.7.0 Notion JS library version: 0.4.1
Steps to reproduce the behavior:
- Setup a vite-project
pnpm dlx create-vite
- Choose
vue-ts
- Install Notion SDK
pnpm install @notionhq/client
- Insert Code Snippet
<script setup lang="ts">
import { Client } from '@notionhq/client'
const notion = new Client({ auth: process.env.NOTION_ACCESS_TOKEN })
</script>
<template>
<div>
Test
</div>
</template>
Expected behavior
It should display on localhost:3000
Test
without errors.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Module "stream" has been externalized for browser ... - GitHub
The browser will say Uncaught Error: Module "stream" has been externalized for browser compatibility and cannot be accessed in client code.
Read more >Module "path" has been externalized for browser compatibility
Module "path" has been externalized for browser compatibility and cannot be accessed in client code. Solution. Steps: Install "path-browserify":.
Read more >Uncaught Error: Module "events" has been externalized for ...
Error : Module "events" has been externalized for browser compatibility. Cannot access "events.EventEmitter" in client code. git repo link : ...
Read more >Module "stream" has been externalized for browser compatibility
The Airtable npm module is only for Node, not browsers. You need to put the code related to that module in a server...
Read more >Module "stream" has been externalized for browser compatibility
I'm trying to access the Airtable API with Sveltekit and am running into the following error: Module "stream" has been externalized for browser...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
me too, Is there a new solution now?
Same for me, now I have
Uncaught SyntaxError: The requested module '/node_modules/@notionhq/client/build/src/index.js?v=fcc54f13' does not provide an export named 'Client'