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: Cannot find module 'node:querystring' #215

Closed
Magesh3590 opened this issue Sep 18, 2024 · 14 comments
Closed

Error: Cannot find module 'node:querystring' #215

Magesh3590 opened this issue Sep 18, 2024 · 14 comments

Comments

@Magesh3590
Copy link

Error: Cannot find module 'node:querystring'

@LOKIE98
Copy link

LOKIE98 commented Sep 18, 2024

I'm also facing this issue after the recent update from 1.0.0.next.24 to 1.0.0.next.27.
This is one change I can find
const qs = require('node:querystring'); -> in 1.0.0.next.27
const qs = require('querystring'); -> in 1.0.0.next.24

@nogashimoni
Copy link

Same here :(

@lukezavrel
Copy link

Same here, i temporary fixed the issue by adding "@polka/url": "1.0.0-next.25" to my package.json

@orange9912
Copy link

Same here, or switch the node version to 16

@cihanselim
Copy link

cihanselim commented Sep 18, 2024

+1

temporarily solved it by adding the following lines to the package.json:

"resolutions": { "@polka/url": "1.0.0-next.24" },

!! I use yarn. if you use npm, change resolutions to overrides

@mitjap
Copy link

mitjap commented Sep 18, 2024

What version of node are you guys running?

@xqin
Copy link

xqin commented Sep 19, 2024

What version of node are you guys running?

node v14.16.0

@xqin
Copy link

xqin commented Sep 19, 2024

@lukeed

Please unpublish version of v1.0.0-next.27 first, thanks.

This is a breaking change and should not use a patch version number.

@lukeed
Copy link
Owner

lukeed commented Sep 19, 2024

I take it you’re all using Node < 16, but are you using import or require syntax?

@xqin
Copy link

xqin commented Sep 19, 2024

I take it you’re all using Node < 16, but are you using import or require syntax?

require

UnhandledPromiseRejectionWarning: Error: Cannot find module 'node:querystring'
Require stack:
- /app/node_modules/@polka/url/build.js
- /app/node_modules/sirv/build.js
- /app/node_modules/webpack-bundle-analyzer/lib/viewer.js
- /app/node_modules/webpack-bundle-analyzer/lib/index.js
- /app/node_modules/**********/lib/configs/webpack.base.config.js
- /app/node_modules/**********/lib/configs/webpack.prod.config.js
- /app/node_modules/**********/lib/adapter.js
- /app/node_modules/**********/lib/index.js

https://unpkg.com/sirv@2.0.4/build.js

image

@xqin
Copy link

xqin commented Sep 19, 2024

@lukeed The use of @polka/url package is an indirect dependency.

➜  app npm list @polka/url
app@1.0.0 /opt/app
└─┬ webpack-bundle-analyzer@4.10.2
  └─┬ sirv@2.0.4
    └── @polka/url@1.0.0-next.27

The question is: why does sirv depend on the next version of @polka/url, but the stable version?

And it seems that the sirv package is also maintained by you.

Should the sirv package adjust its dependence on @polka/url to be a stable version?

@lukeed
Copy link
Owner

lukeed commented Sep 19, 2024

I just published a 1.0.0-next.28 for all packages, which strips the node: prefix for all CommonJS packages. You will get these files via a require statement.

The ESM version of each package still has the node: prefix. You will only get this version if you are using import syntax.
The node: prefix was added in 16.x and back-ported to 14.18 (docs), so ensure you're on at least one of those versions. While native ESM was technically added in 12.x, it's been end-of-life (including security) for ~3 years and its version of "ESM" is significantly broken/different than today's ESM... 12.x was the first (experimental) ESM release.

@xqin
Copy link

xqin commented Sep 19, 2024

Verified, thank you for the quick response :)

@lukeed lukeed closed this as completed Sep 19, 2024
@alex921131958
Copy link

quick response :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants