node-pg-migrate: `pg@8.15.1` breaks node-pg-migrate: cannot access './lib/connection-parameters.js' due to package exports
Describe the bug
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath ‘./lib/connection-parameters.js’ is not defined by “exports” in [path-to-repo]\node_modules\pg\package.json
Steps to reproduce
No response
Logs
No response
System Info
window & linux
System:
OS: Windows 11 10.0.22631
CPU: (12) x64 12th Gen Intel(R) Core(TM) i7-1255U
Memory: 13.70 GB / 31.83 GB
Binaries:
Node: 23.11.0 - C:\Program Files\nodejs\node.EXE
npm: 10.9.2 - C:\Program Files\nodejs\npm.CMD
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 16 (4 by maintainers)
Just a heads-up: I’ve submitted a PR to the
pgrepo to fix the issue we encountered. The problem was due topg@8.15.1restricting access to internal modules likelib/connection-parameters.js, whichnode-pg-migraterelies on.The PR is here: https://github.com/brianc/node-postgres/pull/3428. Once it’s merged and a new
pgversion is released, updating should resolve the issue.In the meantime, downgrading to
pg@8.14.1is a viable workaround.Thanks for your patience!
Hey sorry about that. PR merged (thank you @brenoepics for the fix while I was sleeping!) and a new patch version of pg related modules released now. pg@8.15.2 should work. Please feel free to report any other issues you find!
its okay to import deeply if you need to, though it wouldn’t hurt to LMK what you need exported more “officially” and I can do that - that makes it more a part of the public API. I’ve learned through this incident though anything you put on npm can be considered the public API if its importable and your lib is installed enough. 😄
I have fixed this on my side so you should be good if you just update to the most recent version of
pg- if you run into any other issues please don’t hesitate to let me know, and thanks for this package!Weird that even with that I couldn’t make it work (maybe because I 'm using 8). Had to add a
package.jsonand pin it there instead. Hope your PR gets merged soon, thanks 💯Likely possible with something like
npx --package node-pg-migrate --package pg@8.14.1 node-pg-migrate --versionBy default,npxinstalls the latest versions of dependencies, so without pinningpg, it pulls8.15.1, which breaks internal imports.I’m investigating the problem and have already managed to reproduce it. Apparently, it’s the latest minor version of
pg(8.15.1) that no longer exports this—possibly related to https://github.com/brianc/node-postgres/pull/3423 and https://github.com/brianc/node-postgres/compare/pg%408.14.1...pg%408.15.1.I downgrade the pg dependency to
"pg": "8.14.1"and it works tooforce version
"pg": "8.11.3"(in my packages dependencies) made it start working