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

The punycode module is deprecated #626

Closed
Fil opened this issue Jan 29, 2024 · 4 comments
Closed

The punycode module is deprecated #626

Fil opened this issue Jan 29, 2024 · 4 comments
Labels
bug Something isn’t working

Comments

@Fil
Copy link
Contributor

Fil commented Jan 29, 2024

DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
@Fil Fil added the bug Something isn’t working label Jan 29, 2024
@mbostock
Copy link
Member

I haven’t seen this. Where did you see this warning, and where is it generated?

@Fil
Copy link
Contributor Author

Fil commented Jan 30, 2024

Looks like a yarn issue that surfaced with node 21.
yarnpkg/yarn#9005

I don't think we need to do anything, but wait for yarn to get fixed.

I saw it in the build logs of https://huggingface.co/spaces/observablehq/french-newspapers?logs=build

===== Build Queued at 2024-01-29 13:42:58 / Commit SHA: 6d24261 =====

--> FROM docker.io/library/node:latest@sha256:0ded28778059262bd3c066b609186e5b6c89550a9362dce4309ad67c95af0d77
DONE 0.0s

--> RUN arch # print arch info
CACHED

--> RUN useradd -o -u 1000 user
CACHED

--> WORKDIR /home/user/app
CACHED

--> Restoring cache
DONE 6.8s

--> COPY --chown=user . /home/user/app
DONE 0.7s

--> RUN npm install -g serve

added 89 packages in 2s

24 packages are looking for funding
  run `npm fund` for details
npm notice 
npm notice New minor version of npm available! 10.2.4 -> 10.4.0
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.4.0>
npm notice Run `npm install -g [email protected]` to update!
npm notice 
DONE 1.8s

--> RUN wget --quiet https://github.com/duckdb/duckdb/releases/download/v0.9.2/duckdb_cli-linux-amd64.zip -O duckdb.zip &&     unzip duckdb.zip && chmod +x duckdb && mv duckdb /usr/local/bin
Archive:  duckdb.zip
  inflating: duckdb                  
DONE 0.7s

--> RUN mkdir -p /tmp/ # note: useless since /tmp already exists
DONE 0.2s

--> RUN yarn && yarn build
yarn install v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
(node:7) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
[3/4] Linking dependencies...
warning "@observablehq/cli > [email protected]" has unmet peer dependency "@types/markdown-it@*".
[4/4] Building fresh packages...
Done in 5.61s.
yarn run v1.22.19
$ rm -rf dist && observable build
…

(not a huge issue)

@Fil Fil closed this as completed Jan 30, 2024
@Fil
Copy link
Contributor Author

Fil commented Mar 11, 2024

I investigated this a bit more today, since it seems that it is now fixed in yarn 1.22.22: yarnpkg/yarn#9013

I upgraded yarn, but still saw the warning; however running with
❯ NODE_OPTIONS='--trace-deprecation' yarn dev --no-open
showed that the error was now coming from
node_modules/markdown-it/lib/index.js:14:20

fixing it then showed the same issue coming from a transitive dependency psl (jsdom#tough-cookie#psl):
node_modules/psl/index.js:5:16

fixing that, and the warning was gone.

To sum up, three of our dependencies will need an upgrade: yarn, markdown-it, and psl.

The fix in both cases was to transform require("punycode") into require("punycode/"); I haven't tried to understand what it did or why.

@wetlandscapes
Copy link

Just an FYI, I get the "punycode" warning when pulling the official node.js docker image (v21, Debian "bookworm"). I tried updating yarn before creating the observable project, but that didn't seem to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn’t working
Projects
None yet
Development

No branches or pull requests

3 participants