webpack / webpack

A bundler for javascript and friends. Packs many modules into a few bundled assets. Code Splitting allows for loading parts of the application on demand. Through "loaders", modules can be CommonJs, AMD, ES6 modules, CSS, Images, JSON, Coffeescript, LESS, ... and your custom stuff.

Home Page:https://webpack.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nodejs 17: digital envelope routines::unsupported

akornatskyy opened this issue · comments

Bug report

What is the current behavior?

[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 (/opt/src/node_modules/webpack/lib/util/createHash.js:155:18)
    at BulkUpdateDecorator.digest (/opt/src/node_modules/webpack/lib/util/createHash.js:80:21)
    at /opt/src/node_modules/webpack/lib/DefinePlugin.js:595:38
    at Hook.eval [as call] (eval at create (/opt/src/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:100:1)
    at Hook.CALL_DELEGATE [as _call] (/opt/src/node_modules/tapable/lib/Hook.js:14:14)
    at Compiler.newCompilation (/opt/src/node_modules/webpack/lib/Compiler.js:1053:26)
    at /opt/src/node_modules/webpack/lib/Compiler.js:1097:29
    at Hook.eval [as callAsync] (eval at create (/opt/src/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Other relevant information:
webpack version: 5.59.0
Node.js version: 17.0.0
Operating System: linux x64

Why do you ignore reproducible repo? What is output.hashFunction/output.hashDigest and etc? I see...

workaround:

export NODE_OPTIONS=--openssl-legacy-provider

The same situation is also with webpack@4. I hope that it will be fixed in the legacy versions too since I'm blocked to use the actual webpack versions in legacy projects due to the requirement of the support of old NodeJS versions.

Yes, marked as critical

The same situation is also with webpack@4. I hope that it will be fixed in the legacy versions too since I'm blocked to use the actual webpack versions in legacy projects due to the requirement of the support of old NodeJS versions.

We will not update that in webpack 4.

For webpack 4 solutions:

  • export NODE_OPTIONS=--openssl-legacy-provider
  • monkey patching crypto for md4 and Node.js v17

hmm... We can't really automatically fallback to a different hashing algorithm, since this would break the determinism of builds (builds should be equal independent of node.js version).

We are planning to migrate to a different hash function anyway for webpack 6. So currently you will have to use output.hashFunction: "xxhash64" in configuration to fix that. Or --openssl-legacy-provider

Seems like the need to release a new major becomes more pressing...

To be honestly it is very strange from Node.js developers, no deprecation messages, they just remove it... and break a lot of packages

To be honestly it is very strange from Node.js developers, no deprecation messages, they just remove it... and break a lot of packages

node.js 17 uses OpenSSL3 which have changed code for initialization context of md family (including md4):
https://wiki.openssl.org/index.php/OpenSSL_3.0#Upgrading_to_OpenSSL_3.0_from_OpenSSL_1.0.2

But I agree that node.js could have warned you in advance, given that you are one of the biggest consumers.

workaround:

export NODE_OPTIONS=--openssl-legacy-provider

where should this be added?

@FSM1 : if you use bash or related just execute that before you work with webpack.

For example, I was running into this issue when running gatsby build, so adding this to my NPM build script fixed the issue:

{
  "scripts": {
    "build": "export NODE_OPTIONS=--openssl-legacy-provider; gatsby build"
  }
}

@romellem that would not work... if you want to have this as a part of your npm script you need:

env NODE_OPTIONS=--openssl-legacy-provider gatsby build
commented

I have replaced in package.json of the project:

"start": "react-scripts start"
"build": "react-scripts build"

with:

"start": "react-scripts --openssl-legacy-provider start",
"build": "react-scripts --openssl-legacy-provider build",

It worked

For example, I was running into this issue when running gatsby build, so adding this to my NPM build script fixed the issue:

{
  "scripts": {
    "build": "export NODE_OPTIONS=--openssl-legacy-provider; gatsby build"
  }
}

That's maybe gonna work on Linux base OS.
for Windows OS you need add

{ "scripts": { "build": "set NODE_OPTIONS=--openssl-legacy-provider & gatsby build" } }

@xdadev37 env prefix (see example above) should work cross platform.

@xdadev37 env prefix (see example above) should work cross platform.

'env' is not recognized as an internal or external command
I not sure because I got this error from that on Windows 11

@alexander-akait had the idea to fallback to a wasm implementation of md4, similar to the wasm implementation of xxhash64 and that seem to be possible...

You could use cross-env like so, to make it work on linux and windows:
{ scripts: { "build": "cross-env NODE_OPTIONS=--openssl-legacy-provider gatsby build" } }

I am using xxhash64. Generally, it works, but I get lot of warnings. like this:

<w> [webpack.cache.PackFileCacheStrategy] Skipped not serializable cache item 'Compilation/codeGeneration|d:\projects\devel\repmeter\app\node_modules\babel-loader\lib\index.js??clonedRuleSet-3!d:\projects\devel\repmeter\app\node_modules\core-js\internals\string-pad-webkit-bug.js|app': error:0308010C:digital envelope routines::unsupported
<w> while serializing webpack/lib/cache/PackFileCacheStrategy.PackContentItems -> Object { sources, runtimeRequirements, data } -> Map { 1 items } -> webpack/lib/util/registerExternalSerializer.webpack-sources/CachedSource -> Object { buffer, source, size, maps, hash } -> Array { 3 items } -> Buffer
<w> [webpack.cache.PackFileCacheStrategy] Skipped not serializable cache item 'Compilation/codeGeneration|d:\projects\devel\repmeter\app\node_modules\babel-loader\lib\index.js??clonedRuleSet-3!d:\projects\devel\repmeter\app\node_modules\core-js\internals\ieee754.js|app': error:0308010C:digital envelope routines::unsupported
<w> while serializing webpack/lib/cache/PackFileCacheStrategy.PackContentItems -> Object { sources, runtimeRequirements, data } -> Map { 1 items } -> webpack/lib/util/registerExternalSerializer.webpack-sources/CachedSource -> Object { buffer, source, size, maps, hash } -> Buffer
<w> [webpack.cache.PackFileCacheStrategy] Skipped not serializable cache item 'Compilation/codeGeneration|d:\projects\devel\repmeter\app\node_modules\babel-loader\lib\index.js??clonedRuleSet-3!d:\projects\devel\repmeter\app\node_modules\vue-loader\dist\index.js??ruleSet[0]!d:\projects\devel\repmeter\app\src\views\private\project-view-only.vue?vue&type=script&lang=js|app': error:0308010C:digital envelope routines::unsupported
<w> while serializing webpack/lib/cache/PackFileCacheStrategy.PackContentItems -> Object { sources, runtimeRequirements, data } -> Map { 1 items } -> webpack/lib/util/registerExternalSerializer.webpack-sources/CachedSource -> Object { buffer, source, size, maps, hash } -> Array { 6 items } -> Buff

@zdm I think you need to update webpack to the latest stable version

@zdm Can you provide reproducible example? Maybe we have bug...

Oh, vue-loader should update https://github.com/vuejs/vue-loader/blob/master/package.json#L54, loader-utils is using md4...

Yep, anyway if you provide example I will investigate

SOLUTION for React, Vue, Nuxt and Next

Use Node version lower than 17.0.0.
And wait for the fix.


Also got this error (I got the "Error: error:0308010C:digital envelope routines::unsupported") after just creating a new project with React or Vue:

Node.js v17.0.1
NPM v8.1.0
Windows 10 Latest

I just got this error from my other projects too after updating Node to 17.0.1 and NPM to 8.10. Probably has something to do with Node version.

REPRODUCTION

  1. Use Node.js version 17.0.1 (can change with nvm)
  2. npx create-react-app my-app or vue create hello-world
  3. npm start(react) or npm run serve(vue)
  4. get the error _digital envelope routines::unsupported

Also happens in Nuxt.js.

Full error:

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:67:19)
    at Object.createHash (node:crypto:130:10)
    at module.exports (C:\Users\myUserName\Desktop\CODES\REACT\PROJECTS\test-react-app-of-mine\node_modules\webpack\lib\util\createHash.js:135:53)
    at NormalModule._initBuildHash (C:\Users\myUserName\Desktop\CODES\REACT\PROJECTS\test-react-app-of-mine\node_modules\webpack\lib\NormalModule.js:417:16)
    at C:\Users\myUserName\Desktop\CODES\REACT\PROJECTS\test-react-app-of-mine\node_modules\webpack\lib\NormalModule.js:452:10
    at C:\Users\myUserName\Desktop\CODES\REACT\PROJECTS\test-react-app-of-mine\node_modules\webpack\lib\NormalModule.js:323:13
    at C:\Users\myUserName\Desktop\CODES\REACT\PROJECTS\test-react-app-of-mine\node_modules\loader-runner\lib\LoaderRunner.js:367:11
    at C:\Users\myUserName\Desktop\CODES\REACT\PROJECTS\test-react-app-of-mine\node_modules\loader-runner\lib\LoaderRunner.js:233:18
    at context.callback (C:\Users\myUserName\Desktop\CODES\REACT\PROJECTS\test-react-app-of-mine\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
    at C:\Users\myUserName\Desktop\CODES\REACT\PROJECTS\test-react-app-of-mine\node_modules\babel-loader\lib\index.js:59:103 {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Node.js v17.0.1

hm, we really need investigate this, anybody can provide example of the problem?

@onurusluca Do you mean nodejs 17: digital envelope routines::unsupported or Skipped not serializable cache item? If first just use NODE_OPTIONS=--openssl-legacy-provider, anyway we have idea how to fix it without breaking change for v5, we will reimplement md4 using wasm version, anyway I strong recommend to switch on xxhash64

@alexander-akait

I got the Error: error:0308010C:digital envelope routines::unsupported error.
I am using Node v16 but just wanted to try out v17 and when I ran a local project I got this error. I am just gonna keep using v16 for now. Thanks

I recommend install nvm and install v14.15.0 (using nvm you can change node version and solve this problems)

@FSM1 : if you use bash or related just execute that before you work with webpack.
It's working, thanks!

Windows:

  "scripts": {
    "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
    "build": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build",
    "lint": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service lint"
  },
commented

For example, I was running into this issue when running gatsby build, so adding this to my NPM build script fixed the issue:

{
  "scripts": {
    "build": "export NODE_OPTIONS=--openssl-legacy-provider; gatsby build"
  }
}

That's maybe gonna work on Linux base OS. for Windows OS you need add

{ "scripts": { "build": "set NODE_OPTIONS=--openssl-legacy-provider & gatsby build" } }

This worked with angular too! Though when executing the commands manually using Windows PowerShell the only way it works is by entering those two commands simultaneously dividing them with the & sign, while in bash you can first throw the export command and then build and that works. Hopefully I made it clear

I am a beginner and trying to create my first react app but after running npm start it is giving this error. ``
How can I solve this problem and continue creating my first app?
I am a beginner so please give me the code that I need to run
I am currently running it on Linux Ubuntu 20.04 of Debian distribution

`Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:67:19)
at Object.createHash (node:crypto:130:10)
at module.exports (/home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/webpack/lib/NormalModule.js:417:16)
at handleParseError (/home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/webpack/lib/NormalModule.js:471:10)
at /home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/webpack/lib/NormalModule.js:503:5
at /home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/webpack/lib/NormalModule.js:358:12
at /home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/loader-runner/lib/LoaderRunner.js:373:3
at iterateNormalLoaders (/home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at iterateNormalLoaders (/home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
/home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/react-scripts/scripts/start.js:19
throw err;
^

Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:67:19)
at Object.createHash (node:crypto:130:10)
at module.exports (/home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/webpack/lib/NormalModule.js:417:16)
at /home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/webpack/lib/NormalModule.js:452:10
at /home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/webpack/lib/NormalModule.js:323:13
at /home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/loader-runner/lib/LoaderRunner.js:367:11
at /home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/loader-runner/lib/LoaderRunner.js:233:18
at context.callback (/home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at /home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/babel-loader/lib/index.js:59:103 {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Node.js v17.0.1`

@alexander-akait
Repo ot reproduce warnings. when xxhash is used.
https://github.com/zdm/webpack-issue-14532

npm i
npm run build
<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: error:0308010C:digital envelope routines::unsupported
<w> while serializing webpack/lib/util/registerExternalSerializer.webpack-sources/ConcatSource -> Array { 12 items } -> webpack/lib/util/registerExternalSerializer.webpack-sources/RawSource -> Buffer

@zdm hm, weird, I can't reproduce, but maybe it should help #14557, can you try locally to do patch?

Will try. Do you run it under node 17?

For me it is reproduceable under linux and windows, node 17

Confirming my PR #14557 is aiming to solve your problem @zdm. Got the same error as you.

@zloirock Nodejs 16 becomes LTS on October 26 2021 and will go EOL in 2024, so you should have a large window to migrate from Webpack 4 before that expires.

@csvan core-js-builder@3 should support NodeJS 8 for the compatibility reason and I'm not sure that core-js@4 ecosystem will be released this year. Since core-js-builder@3 is the actual version, it should support NodeJS 17 too. Anyway, changing md4 to something else is not a breaking change in this case.

I recommend install nvm and install v14.15.0 (using nvm you can change node version and solve this problems)

This worked for me. Use the version which works.

this error can be solved by using stable version of nodejs

if you have a bash-like shell, this is simplier:
$ NODE_OPTIONS=--openssl-legacy-provider yarn start

Thank you for this solution! I got it to work with create-react-app by using the following:

package.json:

  "scripts": {
    "start": "export SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts start",
    "build": "export SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts build"
  },

@Amishakumari544

this error can be solved by using stable version of nodejs

Node 17 is a current stable version of NodeJS. It's what you get by default if you install NodeJS now without choosing to use an LTS.

this error can be solved by using stable version of nodej

@Amishakumari544

this error can be solved by using stable version of nodejs

Node 17 is a current stable version of NodeJS. It's what you get by default if you install NodeJS now without choosing to use an LTS.

Yes you are right i was also stuck on 17 version but I when I tried sudo n stable my error resolved with 14 version.

Also , before this I removed nodejs and npm and then reinstall it but not the latest then this command .
sudo npm install -g n
sudo n stable

this will give you v14 and that's working fine!

Thank you for this solution! I got it to work with create-react-app by using the following:

package.json:

  "scripts": {
    "start": "export SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts start",
    "build": "export SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts build"
  },

This one also works

Yes you are right i was also stuck on 17 version but I when I tried sudo n stable my error resolved with 14 version.

That's just because n aliases stable to lts. Node has no "stable", they have "current" and "lts" (which can be active or maintenance). Both of which are stable.

Edit: The current Node.js is v16 and v17. The maintenance lts is v14. Tomorrow v16 is going to stop being current and become the active lts.

Yes you are right i was also stuck on 17 version but I when I tried sudo n stable my error resolved with 14 version.

That's just because n aliases stable to lts. Node has no "stable", they have "current" and "lts" (which can be active or maintenance). Both of which are stable.

ok

Thank you for this solution! I got it to work with create-react-app by using the following:
package.json:

  "scripts": {
    "start": "export SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts start",
    "build": "export SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts build"
  },

This one also works

That only works if everyone working on the project uses Node 17. Node 16 or lower will throw an error on the unknown --openssl-legacy-provider flag.

workaround:

export NODE_OPTIONS=--openssl-legacy-provider

Where do we put this code? I tried in the terminal but nothing.

Any idea when it will be fixed for all?

Please, solution is above, just use it

Please, solution is above, just use it

export NODE_OPTIONS=--openssl-legacy-provider

is a workaround and not a solution

@codetributor

where do we insert export NODE_OPTIONS=--openssl-legacy-provider

You place it in your package.json file. I got it to work with create-react-app here:

#14532 (comment)

There are different solutions for Vue and other technologies in the thread.

Interested when they'll update it in webpack.

Interested when they'll update it in webpack.

This was answered earlier.

#14532 (comment)

The only thing WebPack needs to do is change the default for output.hashFunction to "xxhash64" as planned. But that is a breaking change so they cannot do that till WebPack 6.

So until WebPack 6 you just have to manually set output.hashFunction = "xxhash64" in your own WebPack config.

I am not sure if the problem is with node or npm. If I directly run the examples from https://github.com/nodejs/node/blob/master/doc/api/crypto.md in node cli they run fine. Yet when I do npm run build, I get the same error as reported here, especially at line node_modules/webpack/lib/util/createHash.js:155.

This is a terrible issue. I'm struggling and struggling with the build process. Calm down 👊

workaround:

export NODE_OPTIONS=--openssl-legacy-provider

where should this be added?

I faced this issue in docker build, i have added this line in docker
RUN export NODE_OPTIONS=--openssl-legacy-provider && yarn build && yarn install --production --ignore-scripts --prefer-offline

Bug report

What is the current behavior?

[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 (/opt/src/node_modules/webpack/lib/util/createHash.js:155:18)
    at BulkUpdateDecorator.digest (/opt/src/node_modules/webpack/lib/util/createHash.js:80:21)
    at /opt/src/node_modules/webpack/lib/DefinePlugin.js:595:38
    at Hook.eval [as call] (eval at create (/opt/src/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:100:1)
    at Hook.CALL_DELEGATE [as _call] (/opt/src/node_modules/tapable/lib/Hook.js:14:14)
    at Compiler.newCompilation (/opt/src/node_modules/webpack/lib/Compiler.js:1053:26)
    at /opt/src/node_modules/webpack/lib/Compiler.js:1097:29
    at Hook.eval [as callAsync] (eval at create (/opt/src/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Other relevant information: webpack version: 5.59.0 Node.js version: 17.0.0 Operating System: linux x64

if you'd like to continue using the NPM script, you can change the build script to:

// package.json
{
  "scripts": {
    "build": "export NODE_OPTIONS=--openssl-legacy-provider; gatsby build"
  }
}

if you are using docker, you can switch from node:latest to node:lts as a workaround until we get the new webpack version with the fix

Serious question - do people have a hard requirement to use Node 17 or why is there so much panic? What feature of Node 17 (which came out just recently) is so crucial that you cannot run Node 16 (current LTS) in your CI systems or locally?

@csvan I think it affects mostly people using docker and using the node image without any tag (latest by default).
The fix is simple, just use node:lts instead

Serious question - do people have a hard requirement to use Node 17 or why is there so much panic

We don't have a hard requirement, but if possible I'd like to make our local build and run process as foolproof as possible - if I can not worry if a developer has installed latest or LTS Node when setting up their machine then I'm going to have less questions to answer :)

The output.hashFunction fix doesn't work for me - more specifically, it solves one error but there seem to be more instances of the same error with file-loader. I'm looking at replacing that since it's deprecated but the env var fix does seem to work - although it requires cross-env to make it work across platforms.

@olane file-loader is deprecated and should be not used anymore

webpack accepts fix for md4 in near future, anyway you can get this problem using outdated file-loader/url-loader, don't use them please migrate on https://webpack.js.org/guides/asset-modules/. If you need new Node.js support please check you don't use outdated/deprecated loaders/plugins

Same problem when compiling project using Create React App v4.0.3. Our pipeline CI stage breaks in step build when executing npm run build.

Yep, as I said I'm working on upgrading not to use file-loader, just looking for a fix while I do that.

Unfortunately the env var doesn't turn out to work for us because it throws an error on Node 16: node: --openssl-legacy-provider is not allowed in NODE_OPTIONS

My next try will be the hashFunction config option, once I've pulled out the problematic loaders. Is there anything else I'm missing here?

No, should work

And please remember one important rule - Node.js v17 is not LTS, so you can faced with bugs and problems, if you want stability use only LTS versions

workaround:

export NODE_OPTIONS=--openssl-legacy-provider

If your using Docker for your build process insert this environment variable and it will work.

ENV NODE_OPTIONS=--openssl-legacy-provider

workaround:

export NODE_OPTIONS=--openssl-legacy-provider

where should this be added?

I faced this issue in docker build, i have added this line in docker RUN export NODE_OPTIONS=--openssl-legacy-provider && yarn build && yarn install --production --ignore-scripts --prefer-offline

That helped me so much, thank you.

also ENV NODE_OPTIONS=--openssl-legacy-provider in your Dockerfile also works

There are a lot of the same solutions, please read carefully

I'd like to move away from file-loader but in the meantime it would be convenient if there was a file-loader published with loader-utils@3 as a dependency instead of v2 🤪

@slorber It is breaking change, and we will need do major release of url-loader, and this will force other breaking changes, I will do compatibility patch release for v2 when we finish it here, but with limitations for very old Node.js versions (we can't fix it for v4, v6, v8)

commented

Hooray!

@csvan I think it affects mostly people using docker and using the node image without any tag (latest by default). The fix is simple, just use node:lts instead

Can you explain where to use node:lts in gcloud or cloudbuild.yaml or package.json? can you describe more please?

I'd like to move away from file-loader but in the meantime it would be convenient if there was a file-loader published with loader-utils@3 as a dependency instead of v2 🤪

@slorber FWIW I've just moved us to asset modules and although the docs weren't great it was pretty straightforward (for our fairly simple config). That combined with the hashFunction: "xxhash64" fix is working for me on Node 16 and 17.

Looks like there's progress on making this just work regardless though - thanks!

Ping there once the next version is published 🙏


@olane moving to asset modules wasn't so easy for me (facebook/docusaurus#4708), will invest more time on this later.

And there's something else using the missing hash algo in Webpack (can't find exactly what but looks related to something using DefinePlugin), so fixing file-loader won't solve it for me anyway.

@slorber wasm version for v2 loader-utils https://github.com/webpack/loader-utils/releases/tag/v2.0.1, i.e. file-loader (https://github.com/webpack-contrib/file-loader/blob/master/package.json#L44) and other loaders which use old version of loader-utils@2 will work

loader-utils v1 will not get update, time to update your code and deps

just askin : v4 will get a working version too ?
cause i use nextjs and they seem to use v4.46

npm ls webpack
└─┬ next@12.0.1
  ├─┬ @next/react-dev-overlay@12.0.1
  │ └─┬ webpack@4.46.0
  │   └─┬ terser-webpack-plugin@1.4.5
  │     └── webpack@4.46.0 deduped
  ├─┬ @next/react-refresh-utils@12.0.1
  │ └── webpack@4.46.0 deduped
  └─┬ react-server-dom-webpack@0.0.0-experimental-3c4c1c470-20211021
    └── webpack@4.46.0 deduped

EDIT: look like they are working on upgrading webpack in nextjs.
vercel/next.js#30078

workaround:

export NODE_OPTIONS=--openssl-legacy-provider

If your using Docker for your build process insert this environment variable and it will work.

ENV NODE_OPTIONS=--openssl-legacy-provider

Thank you!

workaround:

export NODE_OPTIONS=--openssl-legacy-provider

It worked very well for me! Thanks a lot!!!

If you use webpack@5, just update webpack, you don't need workaround anymore

workaround:

export NODE_OPTIONS=--openssl-legacy-provider

If this is a workaround, and this issue was closed, what is the solution?

this has been fixed with release v5.61.0.