ERR_PACKAGE_PATH_NOT_EXPORTED with version > 2.1.0
See original GitHub issueIf I install mysql2@2.2.5
and run the following:
"use strict";
const mysql = require("mysql2");
const ClientFlags = require("mysql2/lib/constants/client.js");
It throws:
internal/modules/cjs/loader.js:518
throw new ERR_PACKAGE_PATH_NOT_EXPORTED(basePath, mappingKey);
^
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/constants/client.js' is not defined by "exports" in /Users/VisualStudio/node_modules/mysql2package.json
With mysql2@2.1.0
there is no error.
Not sure if its the cause but note the missing slash at the end of the error: node_modules/mysql2package.json
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Ask Question - Stack Overflow
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/sync' is not defined by "exports" in node_modules\csv-parse\package.json.
Read more >error [err_package_path_not_exported]: package subpath
In my case this was raised due to old npm package dependencies. extract-files Version 7 uses a deprecated node function: (node: ...
Read more >Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No 'exports'
Run the npm update command to solve the "Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No 'exports'" and then run npm audit fix --force if necessary.
Read more >import-meta-resolve - npm Package Health Analysis - Snyk
Security and license risk for significant versions ... 2.1.0 ... ERR_PACKAGE_PATH_NOT_EXPORTED — when an export is not defined in an export map (example: ......
Read more >Gatsby sanity deploy issue - Netlify Support Forums
Error: [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath '. ... I tried changing the node version with a .nvmrc but that did not work any ...
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 Free
Top 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
@chrisveness I’d like to avoid promoting access to
./lib
as “official” solution to any problem and rather think of some api accessible from top level importI personally prefer full path as to me it’s a bit more deterministic ( if you have
require('./path/a/b
)` you can change what is acutually required bu adding different files - folder “b” with index.js, b.json etc etc. Also might be a bit more performant ( it’s a tiny bit, but when you have 1000 of files required at startup bu dependencies of dependencies that can add up )