uuidjs/uuid

Package subpath is not defined in exports

Rambou opened this issue · 10 comments

Describe the bug

Using subpackage throws an error. So the const v1 = require('uuid/v1'); throws this error

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './v1' is not defined by "exports" in /tees/node_modules/uuid/package.json

How to reproduce

Try to import v1 like that
const v1 = require('uuid/v1');
and execute

Expected behavior

It should work!
[Clear, concise description of what you expected]

Runtime

  • OS: Linux
  • Runtime: Node.js LTS > (gallium - 16.x)
  • Runtime Version: 16.13.0

Additional information

A solution was to change the uuid module package.json export attribute in node_modules from

".": {
      "node": {
        "module": "./dist/esm-node/index.js",
        "require": "./dist/index.js",
        "import": "./wrapper.mjs"
      },
      "default": "./dist/esm-browser/index.js"
},
"./package.json": "./package.json"

to

".": {
      "node": {
        "module": "./dist/esm-node/index.js",
        "require": "./dist/index.js",
        "import": "./wrapper.mjs"
      },
      "default": "./dist/esm-browser/index.js"
},
"./": "./dist/",
"./package.json": "./package.json"

These imports were deprecated and then removed in v8. Packages should not use them with newer versions and packages should not specify uuid with * version. Please try to find which package does it so we could rise an issue.

Any solution? I'm having similar problem: UnhandledPromiseRejectionWarning:
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './v4' is not defined by "exports" in

Node version 14
"uuid": "8.3.0"

I realized that the problem is with the request library when I use it, it gives the error

Better not use it. Its deprecated already

request and uuid are typically able to coexist just fine.

@TrySound: The request dependency on uuid is "^3.3.2", so I don't think that's actually the issue here.

@fzanfolim: Can you distill this down to a minimally reproducible example? E.g. a github repo or repl.it project... something we can run to actually see the problem. That would be very helpful to us. Thanks!

These imports were deprecated and then removed in v8. Packages should not use them with newer versions and packages should not specify uuid with * version. Please try to find which package does it so we could rise an issue.

Was there any @deprecated (JSDoc) annotation in code for that? Sorry if I missed it.

@Rambou There was not any annotation but there was runtime warning in v7 about these imports usage.
https://unpkg.com/browse/uuid@7.0.3/v1.js

We don't use JSDoc.

Closing. If anyone wants us to reopen, we'll need an SSCCE of some sort... something we can run and and actually inspect the behavior of.

@Rambou There was not any annotation but there was a runtime warning in v7 about these imports usage. https://unpkg.com/browse/uuid@7.0.3/v1.js

Runtime warning was fine then. I think the problem, in general, is finding a way to make such warnings noticeable in developers' IDE. It's a more intuitive and immediate way I think.

@Rambou These imports are removed two 2 years ago already. If some packages does not upgrade their dependencies, they must be replaced with maintained ones. At least for security reasons.