question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Package subpath is not defined in exports

See original GitHub issue

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"

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
broofacommented, Dec 8, 2021

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!

0reactions
TrySoundcommented, Feb 9, 2022

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

49 - Stack Overflow
When the "exports" field is defined, all subpaths of the package are encapsulated and no longer available to importers.
Read more >
package.json is not defined by "exports" · Issue #444 - GitHub
package.json' is not defined by "exports" when upgrading from v7.0.3 to v8.0.0 ... Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath '.
Read more >
Package subpath 'v4' is not defined by 'exports' | bobbyhadz
The error '[ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './v4' is not defined by "exports"' occurs because the uuid module removed the option to import from ...
Read more >
package subpath is not defined by exports in - You.com
First, try to delete node_modules directory and issue a npm install in order to re import dependencies. If problem persist, issue a npm...
Read more >
When I run yarn start , I get this error - Reddit
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/tokenize' is not defined by "exports" in /root/.../package.json.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found