Closed MikeMcC399 closed 2 months ago
The serve dependency fast-url-parser can be patched as a temporary measure. Starting with the following:
mkdir serve-test
cd serve-test
npm init -y
npm install serve
export NODE_OPTIONS='--trace-deprecation'
npx serve -v
Use npm module patch-package
npm install patch-package
add script to package.json
"postinstall": "patch-package"
Edit node_modules\fast-url-parser\src\urlparser.js
Line 401
Change
var punycode = require("punycode");
to
var punycode = require("punycode/");
then execute
npx patch-package fast-url-parser
To verify, execute again:
npx serve -v
There should be no deprecation message, even when running under Node.js 21.x
.
For package managers other than npm, see README of patch-package.
Should I execute the code on top mkdir serve-test..
and then execute the workaround?
@tik9
Should I execute the code on top
mkdir serve-test..
and then execute the workaround?
You would replace serve-test
with the name of your existing repository. Sorry if that was not clear. I just used the name serve-test
to demonstrate the principal of patching. You wouldn't normally be creating a new directory if you already have a repository that you are going to patch.
Node.js 21 is now in maintenance and reaches end-of-life on June 1, 2024.
Description
Running
serve
under Node.js21.x
version causes the following deprecation notice to be displayed:The message is also shown in response to
serve -v
.Node.js v21.0.0 (Current) was released on Oct 17, 2023.
Steps to reproduce
shows
https://nodejs.org/dist/latest-v21.x/docs/api/deprecations.html#DEP0040 lists the deprecation and shows that a runtime deprecation was added to Node.js
v21.0.0
(see https://github.com/nodejs/node/pull/47202).Library version
First reported on version:
14.2.1
Still reproducible with version:14.2.2
Node version
v21.0.0v21.7.3
Related issues