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

Upgrade to Node v18 #5520

Open
gnprice opened this issue Oct 7, 2022 · 1 comment
Open

Upgrade to Node v18 #5520

gnprice opened this issue Oct 7, 2022 · 1 comment
Labels
a-tools upstream: RN Issues related to an issue in React Native

Comments

@gnprice
Copy link
Member

gnprice commented Oct 7, 2022

The successor to #4263.

Node 18 was released 2022-04-19. It will shortly (2022-10-25) be the "active LTS", and will be supported until 2025-04-30. See schedule: https://github.com/nodejs/Release#readme

@gnprice gnprice added a-tools upstream: RN Issues related to an issue in React Native labels Oct 7, 2022
@gnprice
Copy link
Member Author

gnprice commented Oct 7, 2022

I'm now running Node 18 on my desktop. I've run into one issue so far -- react-native start fails with the following error:

info Reloading app...
Failed to construct transformer:  Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at stableHash (/home/greg/z/mobile/node_modules/metro-cache/src/stableHash.js:19:8)
    at Object.getCacheKey (/home/greg/z/mobile/node_modules/metro-transform-worker/src/index.js:593:7)
    at getTransformCacheKey (/home/greg/z/mobile/node_modules/metro/src/DeltaBundler/getTransformCacheKey.js:24:19)
    at new Transformer (/home/greg/z/mobile/node_modules/metro/src/DeltaBundler/Transformer.js:48:9)
    at /home/greg/z/mobile/node_modules/metro/src/Bundler.js:22:29 {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

See this SO question, with several answers: https://stackoverflow.com/questions/69394632/webpack-build-failing-with-err-ossl-evp-unsupported and in particular this answer quoting the Node release notes.

In short it seems that newer Node uses a newer OpenSSL, which has dropped some ancient crypto primitives, but some tools -- Webpack in the case of that SO question, Metro in our case -- are still trying to use them.

  • The immediate workaround, which I'm using for now, is to say NODE_OPTIONS=--openssl-legacy-provider react-native start. This should leave things no worse off than with Node v16.
  • A better fix would be one that switches off of those ancient, now-unsupported crypto algorithms. Upgrading Webpack apparently does that when the issue is in Webpack. Perhaps upgrading Metro will do it for us?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-tools upstream: RN Issues related to an issue in React Native
Projects
None yet
Development

No branches or pull requests

1 participant