Package subpath is not defined in exports
See original GitHub issueDescribe 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:
- Created 2 years ago
- Comments:10 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
request
anduuid
are typically able to coexist just fine.@TrySound: The
request
dependency onuuid
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!
@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.