Skip to content
New issue

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

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

Already on GitHub? # to your account

Errors from conditional exports after upgraded to Node 13.13 #32852

Closed
JLHwung opened this issue Apr 14, 2020 · 8 comments · Fixed by salesforce/akita#447
Closed

Errors from conditional exports after upgraded to Node 13.13 #32852

JLHwung opened this issue Apr 14, 2020 · 8 comments · Fixed by salesforce/akita#447

Comments

@JLHwung
Copy link
Contributor

JLHwung commented Apr 14, 2020

  • Version: Node.js 13.13
  • Platform: 19.4.0 Darwin Kernel Version 19.4.0
  • Subsystem: ES modules

What steps will reproduce the bug?

npm install @babel/compat-data
node -e "require('@babel/compat-data/corejs3-shipped-proposals')"

What is the expected behavior?

It should load the module as expected in Node.js 13.12

What do you see instead?

Error: Cannot find module '@babel/compat-data/corejs3-shipped-proposals'
Require stack:
- /tmp/[eval]
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:952:15)
    at Function.resolve (internal/modules/cjs/helpers.js:78:19)
    at [eval]:1:9
    at Script.runInThisContext (vm.js:131:20)
    at Object.runInThisContext (vm.js:297:38)
    at Object.<anonymous> ([eval]-wrapper:10:26)
    at Module._compile (internal/modules/cjs/loader.js:1123:30)
    at evalScript (internal/process/execution.js:94:25)
    at internal/main/eval_string.js:23:3 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/tmp/[eval]' ]
}

Additional information

Caught by the Babel CI: https://travis-ci.com/github/babel/babel/jobs/319348116#L360

The regression was likely introduced in #32351.

The file structure of @babel/compat-data can be simplified w.l.o.g as

package.json
corejs3-shipped-proposals.js
data/corejs3-shipped-proposals.json

and the package.json:

"exports": {
  "./corejs3-shipped-proposals": "./data/corejs3-shipped-proposals.json"
}

The corejs3-shipped-proposals.js is a proxy which delegates to "./data/corejs3-shipped-proposals.json" for Node.js < 13.3 support.

module.exports = require("./data/corejs3-shipped-proposals.json");
@JLHwung
Copy link
Contributor Author

JLHwung commented Apr 14, 2020

/cc @guybedford

@guybedford
Copy link
Contributor

@JLHwung I created babel/babel#11283 specifically to avoid Babel having this error. Was the above fix not patched and released already?

@JLHwung
Copy link
Contributor Author

JLHwung commented Apr 14, 2020

@guybedford Ahh thanks. It was release in 7.9.0.

For those babel users who are affected by this issue after upgrading to node.js 13.13/12.17, please upgrade @babel/preset-env to 7.9.0.

@JLHwung JLHwung closed this as completed Apr 14, 2020
@guybedford
Copy link
Contributor

Great, I'm glad the early fix here could help!

michaelsbradleyjr added a commit to embarklabs/embark that referenced this issue Apr 24, 2020
Node v13.13.0 introduced a change that is incompatible with `@babel/preset-env`
versions `< 7.9.0`.

See:

nodejs/node#32351
nodejs/node#32852
babel/babel#11283

Bump our direct dependencies to `7.9.5` and manually cause additional bumps in
`yarn.lock` that result in all versions of `@babel/preset-env` installed in the
monorepo's `node_modules` trees being `>= 7.9.0`.
michaelsbradleyjr added a commit to embarklabs/embark that referenced this issue Apr 24, 2020
Node v13.13.0 introduced a change that is incompatible with `@babel/preset-env`
versions `< 7.9.0`.

See:
* nodejs/node#32351
* nodejs/node#32852
* babel/babel#11283

Bump our direct dependencies to `7.9.5` and manually cause additional bumps in
`yarn.lock` that result in all versions of `@babel/preset-env` installed in the
monorepo's `node_modules` trees being `>= 7.9.0`.
michaelsbradleyjr added a commit to embarklabs/embark that referenced this issue Apr 24, 2020
Node v13.13.0 introduced a change that is incompatible with `@babel/preset-env`
versions `< 7.9.0`.

See:
* nodejs/node#32351
* nodejs/node#32852
* babel/babel#11283

Bump our direct dependencies to `7.9.5` and manually cause additional bumps in
`yarn.lock` that result in all versions of `@babel/preset-env` installed in the
monorepo's `node_modules` trees being `>= 7.9.0`.
scottlamb added a commit to scottlamb/moonfire-nvr that referenced this issue May 9, 2020
This addresses this error travis-ci builds have been hitting:

Error: Cannot find module '@babel/compat-data/corejs3-shipped-proposals'
https://travis-ci.org/github/scottlamb/moonfire-nvr/jobs/684922930
nodejs/node#32852 (comment)
@nandorojo
Copy link

nandorojo commented May 16, 2020

I had this problem in building a React Native Bob library. I solved it using nvm install 13.12, which downgraded my node to 13.12.

This solution only applies if you use nvm to manage your Node versions (if you don't I recommend it!)

@mamoonraja
Copy link

FYI, I noticed the same issue in 12.17.x. We have to switch to 12.6.x in Travis for now.

mehdisadeghi added a commit to mehdisadeghi/react-mathjax-preview that referenced this issue Jun 24, 2020
mejackreed added a commit to sul-dlss/dlme that referenced this issue Jul 22, 2020
not to be able to run

nodejs/node#32852

This also updates Mirador to the latest RC
cantino added a commit to feedadoc/feedadoc that referenced this issue Jul 28, 2020
gruve-p added a commit to Groestlcoin/address-encoder that referenced this issue Aug 2, 2020
thebaer added a commit to writefreely/writefreely that referenced this issue Sep 9, 2020
This upgrades @babel/preset-env to 7.9.0 from 7.8.7.

See: nodejs/node#32852 (comment)
jacobq added a commit to jacobq/gulp-jest that referenced this issue Sep 21, 2020
See nodejs/node#32852 (comment)
Was getting error like: `Error: Cannot find module '@babel/compat-data/corejs3-shipped-proposals'`
chriskrycho added a commit to tracked-tools/tracked-maps-and-sets that referenced this issue May 13, 2021
Bump to current `ember-cli-babel`, which transitively requires a version
of `@babel/preset-env` which [fixes the build issue][1]. Then use
`yarn-deduplicate` to resolve all transitive dependencies to the minimum
number of (maximum) versions of those shared dependencies, which results
in *all* 7.x versions of `@babel/preset-env` resolving to a version with
the fix.

[1]: nodejs/node#32852
dabrady added a commit to ProdPerfect/prodperfect-keen-tracking.js that referenced this issue May 13, 2021
wincent added a commit to wincent/masochist that referenced this issue Jul 6, 2021
On new machine, we have a newer NodeJS, so we're running into this:

    Error: Cannot find module '$path_to/@babel/compat-data/data/corejs3-shipped-proposals'

Which I think is the issue described here:

    nodejs/node#32852

and fixed here:

    babel/babel#11283

I just ran `yarn upgrade-interactive` and updated all the packages which
looked safe-ish.
@AndersDJohnson
Copy link

Ran into similar problem, though on a later Node version and using yarn not npm, but this worked for me:

yarn upgrade --scope @babel

@cluis13915
Copy link

Ran into similar problem, though on a later Node version and using yarn not npm, but this worked for me:

yarn upgrade --scope @babel

This worked for me. Thanks!

ember-cli: 3.4.4
node: 12.22.12

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

Successfully merging a pull request may close this issue.

6 participants