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. Please use a userland alternative instead. #355

Open
baditaflorin opened this issue Apr 30, 2024 · 5 comments

Comments

@baditaflorin
Copy link

node:41352) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
    at node:punycode:3:9
    at BuiltinModule.compileForInternalLoader (node:internal/bootstrap/realm:398:7)
    at BuiltinModule.compileForPublicLoader (node:internal/bootstrap/realm:337:10)
    at loadBuiltinModule (node:internal/modules/helpers:113:7)
    at Module._load (node:internal/modules/cjs/loader:1053:17)
    at Module.require (node:internal/modules/cjs/loader:1290:19)
    at require (node:internal/modules/helpers:188:18)
    at Object.<anonymous> ([...]/node_modules/node-geocoder/node_modules/whatwg-url/lib/url-state-machine.js:2:18)
    at Module._compile (node:internal/modules/cjs/loader:1455:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1534:10)
    at Module.load (node:internal/modules/cjs/loader:1265:32)
    at Module._load (node:internal/modules/cjs/loader:1081:12)
    at Module.require (node:internal/modules/cjs/loader:1290:19)
    at require (node:internal/modules/helpers:188:18)
    at Object.<anonymous> ([...]/node_modules/node-geocoder/node_modules/whatwg-url/lib/URL-impl.js:2:13)
    at Module._compile (node:internal/modules/cjs/loader:1455:14)
➜  git:(main) ✗ npm install node-geocoder@latest


up to date, audited 229 packages in 2s

35 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Looking at the package lock I see that nide-geocoder it's using node fetch 2.7.0 when the latest version is 3.3.2
The old version 2.7 of node fetch requires a antiquated version 5 of "whatwg-url": "^5.0.0"
When the latest version of "whatwg-url": is 14

"node_modules/node-geocoder/node_modules/node-fetch": {
  "version": "2.7.0",
  "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
  "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
  "dependencies": {
    "whatwg-url": "^5.0.0"
  },
  "engines": {
    "node": "4.x || >=6.0.0"
  },
  "peerDependencies": {
    "encoding": "^0.1.0"
  },
  "peerDependenciesMeta": {
    "encoding": {
      "optional": true
    }
  }
},
@baditaflorin
Copy link
Author

I can confirm that if I change the package-lock.json to have the whatwg-url version to be exactly 14.0.0 the code works.
But this it's not sustainable as I want to run the script from a pipeline and the user should be able to just npm install and everything should work, so this requires that the package version be updated from you guys.

If not I need to do this ugly stept that would not allow me to easaly integrate this into some open terraform configuration that just does a npm install and things work

    "node_modules/node-geocoder/node_modules/node-fetch": {
      "version": "2.7.0",
      "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
      "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
      "dependencies": {
        "whatwg-url": "14.0.0"
      },
      "engines": {
        "node": "4.x || >=6.0.0"
      },
      "peerDependencies": {
        "encoding": "^0.1.0"
      },
      "peerDependenciesMeta": {
        "encoding": {
          "optional": true
        }
      }
    },

@baditaflorin
Copy link
Author

Macos latest os

node -v
v22.0.0
➜ git:(main) ✗ npm -v
10.5.1

@nchaulet
Copy link
Owner

nchaulet commented May 3, 2024

Hi @baditaflorin thanks for reporting this I think we probably can switch to use the native fetch module of nodejs here.

@miha42-github
Copy link

Hi @nchaulet wondering when you might be able to make this fix? I'm running into the same challenge. I took a look at your 5.X branch and noticed there's still a dependency on the older version of node-fetch. I think can silence the deprecation warning in my package, but that's not ideal either.

@nchaulet
Copy link
Owner

nchaulet commented Dec 2, 2024

Hi @nchaulet wondering when you might be able to make this fix? I'm running into the same challenge. I took a look at your 5.X branch and noticed there's still a dependency on the older version of node-fetch. I think can silence the deprecation warning in my package, but that's not ideal either.

Hi @miha42-github yes the 5.x is a work in progress but the goal is to remove dependency on node-fetch, I will try a look later this week to see if there is an alternative we could use for the 4.x version

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

3 participants