laravel-mix: Doesn't work on Node 17

Maintainer’s note: Mix v6.0.36 should fix this problem for most. If you have further issues please add a comment with details about your environment and setup.


  • Laravel Mix Version: v6.0.0 (npm list --depth=0)
  • Node Version (node -v): 17.0.1
  • NPM Version (npm -v): 8.1.1
  • OS: Windows/Linux/WSL2

Description:

Using the package gives the following error:

[webpack-cli] Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:67:19)
    at Object.createHash (node:crypto:130:10)
    at BulkUpdateDecorator.hashFactory (S:\Project\node_modules\webpack\lib\util\createHash.js:155:18)
    at BulkUpdateDecorator.digest (S:\Project\node_modules\webpack\lib\util\createHash.js:80:21)
    at S:\Project\node_modules\webpack\lib\DefinePlugin.js:595:38
    at Hook.eval [as call] (eval at create (S:\Project\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:194:1)
    at Hook.CALL_DELEGATE [as _call] (S:\Project\node_modules\tapable\lib\Hook.js:14:14)
    at Compiler.newCompilation (S:\Project\node_modules\webpack\lib\Compiler.js:1053:26)
    at S:\Project\node_modules\webpack\lib\Compiler.js:1097:29
    at Hook.eval [as callAsync] (eval at create (S:\Project\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:22:1) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Steps To Reproduce:

npm run dev

Related

https://github.com/webpack/webpack/issues/14532

Woraround

There is a workaround:

export NODE_OPTIONS=--openssl-legacy-provider

For what I could gather, latest node changes OpenSSL implementation and this makes Webpack FUBAR. The above workaround forces to use the “legacy” provider.

That or use Vite or Snowpack 🤐

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 8
  • Comments: 15

Most upvoted comments

Can one of you seeing this issue test the fix/node-17 branch? https://github.com/laravel-mix/laravel-mix/tree/fix/node-17

This should theoretically detect whether or not the openssl legacy provider flag is required when running Node 17 or higher.