next.js: Node.js v17.0.0 - Error starting project in development mode
What version of Next.js are you using?
11.1.2
What version of Node.js are you using?
17.0.0
What browser are you using?
Chrome 94.0.4606.81
What operating system are you using?
Windows 10
How are you deploying your application?
/
Describe the Bug
After updating Node.js to the new version, when starting the project in development mode, the following error is obtained in the terminal.
> test@0.1.0 dev
> next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
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 (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:138971:18)
at BulkUpdateDecorator.update (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:138872:50)
at OriginalSource.updateHash (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack-sources3\index.js:1:10264)
at NormalModule._initBuildHash (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:68468:17)
at handleParseResult (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:68534:10)
at C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:68628:4
at processResult (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:68343:11)
at C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:68407:5
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 (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:138971:18)
at BulkUpdateDecorator.update (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:138872:50)
at OriginalSource.updateHash (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack-sources3\index.js:1:10264)
at NormalModule._initBuildHash (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:68468:17)
at handleParseResult (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:68534:10)
at C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:68628:4
at processResult (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:68343:11)
at C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:68407:5
node:internal/crypto/hash:67
this[kHandle] = new _Hash(algorithm, xofLen);
^
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 (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:138971:18)
at BulkUpdateDecorator.update (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:138872:50)
at OriginalSource.updateHash (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack-sources3\index.js:1:10264)
at NormalModule._initBuildHash (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:68468:17)
at handleParseResult (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:68534:10)
at C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:68628:4
at processResult (C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:68343:11)
at C:\Users\DyauS\Documents\test\node_modules\next\dist\compiled\webpack\bundle5.js:68407:5 {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
Node.js v17.0.0
Expected Behavior
The project is expected to be launched successfully.
To Reproduce
Update Node.js version to 17.0.0, create a new Next.js app using create-next-app
and start Next.js in development mode.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 13
- Comments: 31 (13 by maintainers)
Commits related to this issue
- use xxhash64 by default (#30095) Node.js 17 stopped supporting md4 as hash function and we wanted to use a faster hash function anyway. Fixes: https://github.com/vercel/next.js/issues/30078 — committed to vercel/next.js by sokra 3 years ago
- Add engine resolution to avoid using node 17 https://github.com/vercel/next.js/issues/30078 — committed to Yurickh/sudoku by Yurickh 3 years ago
- Add engine resolution to avoid using node 17 https://github.com/vercel/next.js/issues/30078 — committed to Yurickh/sudoku by Yurickh 3 years ago
- ๐ Fix dependencies (#17) * ๐ Fix immer security vulnerability * ๐ Force resolutions to avoid security issues * Add engine resolution to avoid using node 17 https://github.com/vercel/ne... — committed to Yurickh/sudoku by Yurickh 3 years ago
- Add fix for broken next js support in node v17 - https://github.com/webpack/webpack/issues/14532 - https://github.com/vercel/next.js/issues/30078 — committed to ActionsFundamentals/octodex-rss-renderer by stebje 3 years ago
- Upgrade next to v12 Fix for broken build process with node v17 - https://github.com/ActionsFundamentals/octodex-rss-renderer/actions/runs/1446082217 - https://github.com/vercel/next.js/issues/30078 — committed to ActionsFundamentals/octodex-rss-renderer by stebje 3 years ago
- Debugging: add fix for broken build using node v17 - https://github.com/vercel/next.js/issues/30078 — committed to ActionsFundamentals/octodex-rss-renderer by stebje 3 years ago
- :construction: Use an older node.js version until the issue with VuePress sorts out. See https://github.com/vercel/next.js/issues/30078#issuecomment-947334261 and job logs — committed to ct-js/ct-js by CosmoMyzrailGorynych 3 years ago
- Upgrade to Next 12.0.4 to fix https://github.com/vercel/next.js/issues/30078 — committed to rocicorp/replidraw by aboodman 3 years ago
- chore: update nextjs to 12 Had to upgrade due to this issue: https://github.com/vercel/next.js/issues/30078 — committed to arvidklint/arvidklint.com by arvidklint 3 years ago
- Squashed 'reps/' changes from 4e4f5c2..b91492f b91492f Cannot expose LogContext to caller of createDatabase 967cd93 More extensive logging 26d121f Add requirement on node 16+ - we need it for perf ho... — committed to rocicorp/reflect-draw by aboodman 2 years ago
- Squashed 'reps/' changes from b91492f..ea03af8 ea03af8 add client.ts root file 5c99952 Add client directory f936abe Fix compile error 4e4f5c2 OK it connects with miniflare, wrangler dev, and on prod!... — committed to rocicorp/reflect-draw by aboodman 2 years ago
- use xxhash64 by default (#30095) Node.js 17 stopped supporting md4 as hash function and we wanted to use a faster hash function anyway. Fixes: https://github.com/vercel/next.js/issues/30078 — committed to natew/next.js by sokra 3 years ago
Error present on NextJS 12.0.1 as well.
as @foxscotch said but as a 1 liner for those that are unfamiliar:
Itโs fixed in webpack/webpack#14532, weโre going to create a new release of webpack and upgrade it in Next.js ๐
Verified
Error: error:0308010C:digital envelope routines::unsupported
no longer happens using next@canary ๐This will be fixed by #30743. Note that
issue open === not fixed
. You donโt have to confirm that the issue is not fixed when the issue is open on GitHub.I get this when I try to build the recommended docker file from https://nextjs.org/docs/deployment
Maybe downgrade the docker image to node 16 until the issue is resolved?
EDIT: Solved this by changing all instances of
FROM node:alpine AS deps
toFROM node:16-alpine AS deps
in Dockerfile given in https://nextjs.org/docs/deploymentHi, this has been updated in
v11.1.3-canary.89
of Next.js, please update and give it a try!Hi, this has been updated in
v12.0.3-canary.2
of Next.js, please update and give it a try!@Osama-Z-Ansari - put it in
package.json
#30095
@gunnartorfis as @fbwoolf pointed out above, changing the alpine image in the docker file to
FROM node:16-alpine AS deps
is a workaround.Better to use
xxhash64
, we already is doing it if you setexperiments: { futureDefaults: true }
https://github.com/webpack/webpack/blob/main/lib/config/defaults.js#L824@pkellner this issue happens because of Node.js 17, so itโs probably that youโre using an image to does not have a pinned version.
Experiencing same problem v16.13.0
this seems to be a broader webpack issue, rather than Next-specific. @akornatskyy provided a temporary workaround in an issue from the webpack repo webpack/webpack#14532. in short, you need the
--openssl-legacy-provider
argument to be provided to node; they suggested using theNODE_OPTIONS
environment variable, which did the job for meThe reason is here: https://medium.com/the-node-js-collection/node-js-17-is-here-8dba1e14e382 node no longer supports md4 as hash function. sha1 might be a good choice for hashing with bundles.