Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERR_PACKAGE_PATH_NOT_EXPORTED error on startup with 6.12.0 on Node 12 or 14 #13787

Closed
2 of 7 tasks
EverlastEngineering opened this issue Dec 18, 2021 · 13 comments · Fixed by #13795
Closed
2 of 7 tasks

Comments

@EverlastEngineering
Copy link

EverlastEngineering commented Dec 18, 2021

Issue Creation Checklist

[x] I have read the contribution guidelines

What do you expect to happen?

I want Node 12 or Node 14 to continue to start when using 6.12.0.

What is actually happening?

We receive this error on startup after an npm update today:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package.json' is not defined by "exports" in /Users/xxx/Source/xxx-service/WebContent/node_modules/sequelize/package.json
    at throwExportsNotFound (internal/modules/esm/resolve.js:285:9)
    at packageExportsResolve (internal/modules/esm/resolve.js:508:3)
    at resolveExports (internal/modules/cjs/loader.js:450:36)
    at Function.Module._findPath (internal/modules/cjs/loader.js:490:31)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:888:27)
    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at Object.<anonymous> (/Users/xxx/Source/xxx-service/WebContent/node_modules/sequelize-values/lib/patches.js:9:32)
    at Module._compile (internal/modules/cjs/loader.js:1085:14) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'

Additional context

Manually specifying 6.11.0 works fine. I have not updated node yet since I am mirroring a deployed instance on AWS for support purposes.

Environment

  • Sequelize version: sequelize@6.12.0
  • Node.js version: v14.17.1 or 12.22.7 (untested on others)

Bug Report Checklist

How does this problem relate to dialects?

  • I think this problem happens regardless of the dialect.
  • I think this problem happens only for the following dialect(s):
  • I don't know, I was using PUT-YOUR-DIALECT-HERE, with connector library version XXX and database version XXX

Would you be willing to resolve this issue by submitting a Pull Request?

  • Yes, I have the time and I know how to start.
  • Yes, I have the time but I don't know how to start, I would need guidance.
  • No, I don't have the time, although I believe I could do it if I had the time...
  • No, I don't have the time and I wouldn't even know how to start.
@EverlastEngineering EverlastEngineering changed the title ERR_PACKAGE_PATH_NOT_EXPORTED error on startup with 6.12.0 on Node 12 or 14 (maybe more?) ERR_PACKAGE_PATH_NOT_EXPORTED error on startup with 6.12.0 on Node 12 or 14 Dec 18, 2021
@EverlastEngineering
Copy link
Author

Just to note the severity of this, AWS does an npm update after a server reboot, so anyone with a ^6.0.0 in their package would have a failure.

I'm not sure if I'm unique in my setup or what, but I will certainly provide any additional details on req.

@scalebig
Copy link

Yeah ... this bit us also during a build also.

@WikiRik
Copy link
Member

WikiRik commented Dec 18, 2021

@ephys do you think this might be related to your change?

@sepo-one
Copy link

Same error here

@sepo-one
Copy link

What is the temporary fix ?
(Downgrade to 6.0.0 ?)

@WikiRik
Copy link
Member

WikiRik commented Dec 19, 2021

What is the temporary fix ?
(Downgrade to 6.0.0 ?)

As mentioned in the post, manually specifying 6.11.0 works fine and can be used as a temporary fix

@ephys
Copy link
Member

ephys commented Dec 20, 2021

@WikiRik I think so, the exports property in package.json blocks other imports

Working on a fix

@ephys ephys mentioned this issue Dec 20, 2021
4 tasks
@ephys
Copy link
Member

ephys commented Dec 20, 2021

Should be fixed by #13795

@mohsinriaz17
Copy link

Similar issue on re-deploy on clever cloud, it updated the version

@tapz
Copy link

tapz commented Dec 20, 2021

I started to get this with node 14 after updating from 6.11.0 to 6.12.0:

(node:32) UnhandledPromiseRejectionWarning: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/sql-string' is not defined by "exports" in /app/node_modules/sequelize/package.json

@sdepold
Copy link
Member

sdepold commented Dec 21, 2021

Fixed in 6.12.1 :)

@ollyde
Copy link

ollyde commented Jul 20, 2022

Seeing this error happening again in 6.21.3

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './types' is not defined by "exports" in /Users/oliverdixon/Downloads/testing-s/node_modules/sequelize/package.json
    at new NodeError (node:internal/errors:387:5)
    at throwExportsNotFound (node:internal/modules/esm/resolve:439:9)
    at packageExportsResolve (node:internal/modules/esm/resolve:718:3)
    at resolveExports (node:internal/modules/cjs/loader:493:36)
    at Function.Module._findPath (node:internal/modules/cjs/loader:533:31)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:942:27)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/Users/oliverdixon/Downloads/testing-s/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
    at Function.Module._load (node:internal/modules/cjs/loader:804:27)
    at Module.require (node:internal/modules/cjs/loader:1022:19)
    at require (node:internal/modules/cjs/helpers:102:18) {

@ollyde
Copy link

ollyde commented Jul 20, 2022

Was because I was importing from "sequelize/types" and not "sequelize"

VSC automatically used /types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants