`punycode` deprecated; `psl` and `tough-cookie` packages causing issues
Closed this issue · 4 comments
Issue
Looks like the punycode
module, used in the dependencies psl
and tough-cookie
are deprecated, causing the wizard and package to fail.
Recreate
- Attempt to run following instructions
$ npx wordpress-to-markdown
produces error:
(node:5946) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Investigation
$ npm install wordpress-to-markdown
- Add to package json the
--trace-deprecation
flag
{
"dependencies": {
"wordpress-export-to-markdown": "^2.3.7"
},
"scripts": {
"trace": "NODE_OPTIONS='--trace-deprecation' wordpress-export-to-markdown"
},
}
$ npm run trace
shows me there is an issue withpsl
package, and when I fix, also withtough-cookie
package.
Temporary fix to get to run
Add a trailing forward to slash to two files;
-
./node_modules/psl/index.js
Change line 5, from:
var Punycode = require('punycode');
to
var Punycode = require('punycode/');
-
./node_modules/tough-cookie/lib/cookie.js
Change line 43, from:
punycode = require('punycode');
to
punycode = require('punycode/');
Following these changes, the package works.
Thoughts
Looks like both psl
and tough-cookie
packages need updating, patches need to be made, or alternative dependencies are required.
Until then, these temporary fixes got it working for me.
P.S. Thanks @lonekorean for sharing your work!
Using:
wordpress-export-tomarkdown 2.3.7
macOS Sonoma 14.5
node 22.2.0
npm 10.7.0
Hi @tarihala, thanks for bringing this to my attention and digging into it!
That scary looking deprecation warning is a downstream result of me using this deprecated package. I knew that one day it would cause a problem. Looks like today is that day. 😄
I ripped it out and replaced it with a different package and updated some code. If you have time, can try running it again with this branch?
Should be able to just:
git fetch
git checkout deprecation-fix
npm install
Then run as before.
I'll merge and release a new version soon, but would make me feel better to know it runs smoothly on your computer.
@lonekorean that was fast!
Looks great! That branch works fine on my computer and with my export.xml
file. Nice work! 🎸
Awesome, fix released in v2.4.0. Closing this out, thank you!