vuepress
vuepress copied to clipboard
Node 19 Error: error:0308010C:digital envelope routines::unsupported
- [x] I confirm that this is an issue rather than a question.
Bug report
npm run dev
leads to error Error: error:0308010C:digital envelope routines::unsupported
on Node.js v19.6.1
Steps to reproduce
Run npm run dev
within Vuepress ^1.5.3 (also tried with 1.9.7) on Node.js v19.6.1
What is expected?
Serving the page
What is actually happening?
After building 40% the script crashes
Other relevant information

-
Output of
npx vuepress info
in my VuePress project: Environment Info:System: OS: macOS 11.7.3 CPU: (8) x64 Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz Binaries: Node: 19.6.1 - /usr/local/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 9.4.0 - /usr/local/bin/npm Browsers: Chrome: 111.0.5563.146 Edge: Not Found Firefox: 108.0.1 Safari: 16.3 npmPackages: @vuepress/core: undefined (1.9.7) @vuepress/theme-default: 1.9.7 vuepress: ^1.5.3 => 1.9.7 npmGlobalPackages: vuepress: Not Found
I have seen this also with node 18.15.0. I had to go back to the previous version of node LTS 16.20.0 for it to work.
I have seen this also with node 18.15.0. I had to go back to the previous version of node LTS 16.20.0 for it to work.
I can confirm that this works. Thx
The current node version is 18.0.0
Also see #3095 I wonder if there's a more optimal solution that doesn't require using an older node version.
Is this a problem with Vue, that it can only use Node V16? Is there a way to use current versions of Node so this problem doesn't occur, without doing the insecure "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve" fix?
For those who came here after a yarn create vuepress-site
Would suggest we add this in the template till its fixed though
yarn add cross-env --dev
And modify your package.json scripts
#package.json:
{
"scripts": {
"dev": "cross-env NODE_OPTIONS=--openssl-legacy-provider vuepress dev src",
"build": "cross-env NODE_OPTIONS=--openssl-legacy-provider vuepress build src"
},
}
For those who came here after a
yarn create vuepress-site
Would suggest we add this in the template till its fixed though
yarn add cross-env --dev
And modify your package.json scripts #package.json: { "scripts": { "dev": "cross-env NODE_OPTIONS=--openssl-legacy-provider vuepress dev src", "build": "cross-env NODE_OPTIONS=--openssl-legacy-provider vuepress build src" }, }
Thanks for your solution, it helps me a lot, but as to macOS, there is no need to add cross-env, add the node setting is enough for that:
"docs:build": "NODE_OPTIONS=--openssl-legacy-provider vuepress build docs",
I'm using nodejs 18.16.0
, npm 9.5.1
, vuepress 1.9.10
in Windows 11.
I can successfully run npm run dev
, but get error running npm run build
because Client compiling failed with this error (but why?)
Setting NODE_OPTIONS works.
I'm using
nodejs 18.16.0
,npm 9.5.1
,vuepress 1.9.10
in Windows 11. I can successfully runnpm run dev
, but get error runningnpm run build
because Client compiling failed with this error (but why?) Setting NODE_OPTIONS works.
i had the same problem...I don't know if you still need an answer but for me works change the node version with nvm to node 16.20.0
For those who came here after a
yarn create vuepress-site
Would suggest we add this in the template till its fixed though
yarn add cross-env --dev
And modify your package.json scripts #package.json: { "scripts": { "dev": "cross-env NODE_OPTIONS=--openssl-legacy-provider vuepress dev src", "build": "cross-env NODE_OPTIONS=--openssl-legacy-provider vuepress build src" }, }
Thanks @1gn0r4nd ! It worked for me 🙏🏼
For any who need to use a newer version of node and don't like the idea of using --openssl-legacy-provider
, an alternative solution is to force a specific version of webpack and terser-webpack-plugin. See webpack issue for more details here.
"overrides": {
"[email protected]": {
"terser-webpack-plugin": "^4.2.3"
}
}
In summary the root of this issue is that node 17^ doesn't support the md4 hashing algorithm. So any package which uses crypto.createHash('md4')
will throw this error. Vuepress accepts older versions of webpack which use this algorithm by default. Also webpack depends on an outdated version of terser-webpack-plugin which also uses md4.
Hopefully that is merged soon and will help solve this issue. Then we can bump the version of webpack used here and it should be resolved without the need for an override.
The issue is a node version problem afaik, so the solution for me was to use Node V16 (via NVM). Updated project to later versions of Node don't seem to have the problem.
For any who need to use a newer version of node and don't like the idea of using
--openssl-legacy-provider
, an alternative solution is to force a specific version of webpack and terser-webpack-plugin. See webpack issue for more details here."overrides": { "[email protected]": { "terser-webpack-plugin": "^4.2.3" } }
In summary the root of this issue is that node 17^ doesn't support the md4 hashing algorithm. So any package which uses
crypto.createHash('md4')
will throw this error. Vuepress accepts older versions of webpack which use this algorithm by default. Also webpack depends on an outdated version of terser-webpack-plugin which also uses md4.Hopefully that is merged soon and will help solve this issue. Then we can bump the version of webpack used here and it should be resolved without the need for an override.
This......... Thank you for posting.. I have been looking for a proper work around for ages. I can finally sleep now :)
I'm using
nodejs 18.16.0
,npm 9.5.1
,vuepress 1.9.10
in Windows 11. I can successfully runnpm run dev
, but get error runningnpm run build
because Client compiling failed with this error (but why?) Setting NODE_OPTIONS works.i had the same problem...I don't know if you still need an answer but for me works change the node version with nvm to node 16.20.0
I change node to 16.20.0, it works! Thx bro