`UnhandledSchemeError` when dependency uses `node:assert` imports
See original GitHub issueWhat version of Next.js are you using?
11.1.2
What version of Node.js are you using?
14.17.6
What browser are you using?
ff
What operating system are you using?
linux
How are you deploying your application?
vercel
Describe the Bug
In a project which has micromark-util-events-to-acorn@1.0.1
as a dependency, i get the following error when running yarn dev
:
Module build failed: UnhandledSchemeError: Reading from "node:assert" is not handled by plugins (Unhandled scheme).
Things to note about this package: it uses an export map with a “development” user condition, and node:assert
is only used there, not in the exported production build.
Expected Behavior
No error.
To Reproduce
git clone https://github.com/stefanprobst/issue-next-webpack-node-imports.git
cd issue-next-webpack-node-imports
yarn && yarn add next@latest && yarn dev
- open http://localhost:3000/
- See error message
Issue Analytics
- State:
- Created 2 years ago
- Reactions:19
- Comments:24 (10 by maintainers)
Top Results From Across the Web
UnhandledSchemeError: What is this node:buffer error and ...
Pasted below is a node:buffer error that I've received when using a link to a local route in nextjs. Anyone know how to...
Read more >Issue with import of a node package : r/learnjavascript - Reddit
got is intended for use in Node apps, not on the client side. These errors all relate to got's internal dependencies on built-in...
Read more >Node.js v19.3.0 Documentation
In legacy assertion mode, error messages for objects display the objects, often truncated. To use strict assertion mode: import { strict as assert...
Read more >Builtin Node.js Testing - Whistlr
import test from 'node:test'; import assert from 'node:assert'; ... When used without any further arguments, this will automatically find JS files inside ...
Read more >node path resolve Code Example - Code Grepper
Type 'IterableIterator<[number, Module]>' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.
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 Free
Top 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
Oh, interesting. The reproduction uses
11.1.2
, but upgrading tolatest
does throw the error after all. 👀It might be because the client-side code elimination tool isn’t able to recognize the module you are using is for server-only.
This works as the code can be analyzed and Next.js will know where the
node:
import is being used.Let’s reopen and investigate further.
I’m still getting this error with next.js 12