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

[@nrwl/webpack] digital envelope routines::unsupported #14331

Closed
Badisi opened this issue Jan 13, 2023 · 2 comments · Fixed by #14527
Closed

[@nrwl/webpack] digital envelope routines::unsupported #14331

Badisi opened this issue Jan 13, 2023 · 2 comments · Fixed by #14527
Assignees
Labels
outdated scope: bundlers Issues related to webpack, rollup type: bug

Comments

@Badisi
Copy link

Badisi commented Jan 13, 2023

Current Behavior

After upgrading to Node.js 18, I'm getting the following issue during my build process:

Module build failed (from ./node_modules/@nrwl/webpack/src/utils/web-babel-loader.js):
Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at filename (/Users/jpti/Workspace/src/@badisi/auth-js/node_modules/babel-loader/lib/cache.js:94:23)

According to this stackoverflow, this is due to:

Node uses OpenSSL for its hash functions and encryption on *nix systems. The latest version of OpenSSL disables MD4 by default—which will break any previously working program that uses MD4.

Fix

As we can see from the log, the issue comes from babel-loader.
They fixed it in v9.0.0 by updating the hash method from md4 to sha256.
So the fix here, would be upgrading babel-loader dependency of @nrwl/webpack from ^8.2.2 to ^9.1.2.

Expected Behavior

I expect the build process to work without issues.

Github Repo

No response

Steps to Reproduce

Nx Report

Node : 18.13.0
OS   : darwin x64
npm  : 9.3.0
   
@nrwl/angular : 12.10.1
@nrwl/cypress : 12.10.1
@nrwl/detox : Not Found
@nrwl/devkit : 15.5.0
@nrwl/esbuild : Not Found
@nrwl/eslint-plugin-nx : 15.5.0
@nrwl/expo : Not Found
@nrwl/express : Not Found
@nrwl/jest : 14.8.6
@nrwl/js : 15.5.0
@nrwl/linter : 15.5.0
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/nx-cloud : Not Found
@nrwl/nx-plugin : Not Found
@nrwl/react : Not Found
@nrwl/react-native : Not Found
@nrwl/rollup : 15.5.0
@nrwl/schematics : Not Found
@nrwl/storybook : 12.10.1
@nrwl/web : 15.5.0
@nrwl/webpack : 15.5.0
@nrwl/workspace : 15.5.0
@nrwl/vite : 15.5.0
typescript : 4.3.5

Failure Logs

> nx run demo-app:build:production

assets by status 11 KiB [cached] 9 assets
Entrypoint main = runtime.f093658968f2e35f.js main.9d58a649bcb45253.js
Entrypoint polyfills = runtime.f093658968f2e35f.js polyfills.29495019c5f702cb.js
Entrypoint styles = runtime.f093658968f2e35f.js styles.3e2c4c2556e33291.css styles.7eb190a661d729b5.js
orphan modules 3.28 KiB (javascript) 937 bytes (runtime) [orphan] 7 modules
runtime modules 2.48 KiB 3 modules
cacheable modules 128 bytes (javascript) 482 bytes (css/mini-extract)
  modules with errors 78 bytes [errors]
    ./projects/demo-app/src/main.ts 39 bytes [built] [code generated] [1 error]
    ./projects/demo-app/src/polyfills.ts 39 bytes [built] [code generated] [1 error]
  modules by path ./projects/demo-app/src/*.scss 50 bytes (javascript) 482 bytes (css/mini-extract)
    ./projects/demo-app/src/styles.scss 50 bytes [built] [code generated]
    css ./node_modules/@nrwl/webpack/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[5].oneOf[9].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[5].oneOf[9].use[2]!./node_modules/@nrwl/webpack/node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[5].oneOf[9].use[3]!./projects/demo-app/src/styles.scss 482 bytes [built] [code generated]

ERROR in ./projects/demo-app/src/main.ts
Module build failed (from ./node_modules/@nrwl/webpack/src/utils/web-babel-loader.js):
Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at filename (/Users/Badisi/Workspace/demo-app/node_modules/babel-loader/lib/cache.js:94:23)
    at /Users/Badisi/Workspace/demo-app/node_modules/babel-loader/lib/cache.js:120:39
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/Users/Badisi/Workspace/demo-app/node_modules/babel-loader/lib/cache.js:3:103)
    at _next (/Users/Badisi/Workspace/demo-app/node_modules/babel-loader/lib/cache.js:5:194)
    at /Users/Badisi/Workspace/demo-app/node_modules/babel-loader/lib/cache.js:5:364
    at new Promise (<anonymous>)
    at /Users/Badisi/Workspace/demo-app/node_modules/babel-loader/lib/cache.js:5:97

ERROR in ./projects/demo-app/src/polyfills.ts
Module build failed (from ./node_modules/@nrwl/webpack/src/utils/web-babel-loader.js):
Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at filename (/Users/Badisi/Workspace/demo-app/node_modules/babel-loader/lib/cache.js:94:23)
    at /Users/Badisi/Workspace/demo-app/node_modules/babel-loader/lib/cache.js:120:39
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/Users/Badisi/Workspace/demo-app/node_modules/babel-loader/lib/cache.js:3:103)
    at _next (/Users/Badisi/Workspace/demo-app/node_modules/babel-loader/lib/cache.js:5:194)
    at /Users/Badisi/Workspace/demo-app/node_modules/babel-loader/lib/cache.js:5:364
    at new Promise (<anonymous>)
    at /Users/Badisi/Workspace/demo-app/node_modules/babel-loader/lib/cache.js:5:97

webpack 5.75.0 compiled with 2 errors in 1910 ms

Additional Information

As a test, I forced the installation of [email protected] for @nrwl/webpack in my package-lock.json and it solved the issue.

@Jeffrey-Zutt
Copy link

We're experiencing the exact same issue.
Thanks @Badisi for posting this.

@github-actions
Copy link

github-actions bot commented Mar 3, 2023

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: bundlers Issues related to webpack, rollup type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants