Unable to build on latest NodeJS LTS
See original GitHub issue- Check if updating to the latest Preact version resolves the issue
Describe the bug At latest NodeJS LTS version, getting following error:
> preact build --no-prerender
Build [== ] 10% (0.1s) building✖ ERROR Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:133:10)
at module.exports (/Users/ajwah/al-mabsut/haidh-guide-app/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/Users/ajwah/al-mabsut/haidh-guide-app/node_modules/webpack/lib/NormalModule.js:417:16)
at handleParseError (/Users/ajwah/al-mabsut/haidh-guide-app/node_modules/webpack/lib/NormalModule.js:471:10)
at /Users/ajwah/al-mabsut/haidh-guide-app/node_modules/webpack/lib/NormalModule.js:503:5
at /Users/ajwah/al-mabsut/haidh-guide-app/node_modules/webpack/lib/NormalModule.js:358:12
at /Users/ajwah/al-mabsut/haidh-guide-app/node_modules/loader-runner/lib/LoaderRunner.js:373:3
at iterateNormalLoaders (/Users/ajwah/al-mabsut/haidh-guide-app/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at iterateNormalLoaders (/Users/ajwah/al-mabsut/haidh-guide-app/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
at /Users/ajwah/al-mabsut/haidh-guide-app/node_modules/loader-runner/lib/LoaderRunner.js:236:3
at context.callback (/Users/ajwah/al-mabsut/haidh-guide-app/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at /Users/ajwah/al-mabsut/haidh-guide-app/node_modules/babel-loader/lib/index.js:59:71
I tried resolving it according to recommendation of webpack, by adding inside preact.config.js:
config.output["hashFunction"] = "xxhash64"
which leads to the next error:
Build [== ] 10% (0.1s) building✖ ERROR Error: Digest method not supported
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:133:10)
at module.exports (/Users/ajwah/al-mabsut/haidh-guide-app/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/Users/ajwah/al-mabsut/haidh-guide-app/node_modules/webpack/lib/NormalModule.js:417:16)
at handleParseError (/Users/ajwah/al-mabsut/haidh-guide-app/node_modules/webpack/lib/NormalModule.js:471:10)
at /Users/ajwah/al-mabsut/haidh-guide-app/node_modules/webpack/lib/NormalModule.js:503:5
at /Users/ajwah/al-mabsut/haidh-guide-app/node_modules/webpack/lib/NormalModule.js:358:12
at /Users/ajwah/al-mabsut/haidh-guide-app/node_modules/loader-runner/lib/LoaderRunner.js:373:3
at iterateNormalLoaders (/Users/ajwah/al-mabsut/haidh-guide-app/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at iterateNormalLoaders (/Users/ajwah/al-mabsut/haidh-guide-app/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
at /Users/ajwah/al-mabsut/haidh-guide-app/node_modules/loader-runner/lib/LoaderRunner.js:236:3
at context.callback (/Users/ajwah/al-mabsut/haidh-guide-app/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at /Users/ajwah/al-mabsut/haidh-guide-app/node_modules/babel-loader/lib/index.js:59:71
which is on account of the fact that xxhash64
is a webpack specifc implementation.
Considering that preact is based on webpack; I would have expected the above to just work.
To Reproduce
- In an existing preact project, upgrade to latest NodeJS LTS
- execute build:
preact build --no-prerender
Expected behavior What should have happened when following the steps above?
Issue Analytics
- State:
- Created a year ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Unable to install latest version of nodejs. I try ... - Stack Overflow
I m trying to install nodejs 17.x but I end up installing nodejs 10.19. | OS : Ubuntu 20.04.4 LTS x86_64 | shell...
Read more >Building a JavaScript and Node.js project - Travis CI Docs
This guide covers build environment and configuration topics specific to JavaScript and Node.js projects. Please make sure to read our Tutorial and general ......
Read more >Installing Node.js via package manager
Node.js LTS and npm packages are available in the Main Repository. ... This command in Termux app will install the last available Node.js...
Read more >Could not install Node.js using .msi (Error 1609) - Super User
Today, I was trying to install the current LTS version of Node.js. But every time I run the installer, I get the same...
Read more >Can't install the latest version of NodeJs despite update prior ...
Node.js is available from the NodeSource Debian and Ubuntu binary distributions repository ... sudo apt-get install -y build-essential.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just wanted to update this issue for future posterity with a more elegant solution. In
preact.config.js
just add at the top:Source
I evidently did too! That makes more sense.
I wouldn’t say that – it’s been started, but isn’t going anywhere fast. Part due to lack of time, part due to Webpack feeling quite like legacy tech, especially now that Sokra and co. have created an actual spiritual successor. It’s hard to justify spending my time at this point (as that PR shows, it’s been only my time) when so many better options exist, albeit with a migration cost attached.