Skip to content

Node.js v17 or later requires additional optionsΒ #19

@tkhm

Description

@tkhm

Summary

If you use Node.js v17 or later, you'll face the ERR_OSSL_EVP_UNSUPPORTED when you run npm run start.
And the workaround is the following

export NODE_OPTIONS=--openssl-legacy-provider

It would be helpful if the book mention this point in some ways.

Detail

I just started to read the book and faced an issue on chap 1's Run the server step.

Here is the error message.

node:internal/crypto/hash:69
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:69:19)
    at Object.createHash (node:crypto:138:10)
    at module.exports (/Users/tkhm/git/walk-the-dog/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/Users/tkhm/git/walk-the-dog/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/Users/tkhm/git/walk-the-dog/node_modules/webpack/lib/NormalModule.js:471:10)
    at /Users/tkhm/git/walk-the-dog/node_modules/webpack/lib/NormalModule.js:503:5
    at /Users/tkhm/git/walk-the-dog/node_modules/webpack/lib/NormalModule.js:358:12
    at /Users/tkhm/git/walk-the-dog/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/Users/tkhm/git/walk-the-dog/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at Array.<anonymous> (/Users/tkhm/git/walk-the-dog/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
    at Storage.finished (/Users/tkhm/git/walk-the-dog/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
    at /Users/tkhm/git/walk-the-dog/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
    at /Users/tkhm/git/walk-the-dog/node_modules/graceful-fs/graceful-fs.js:123:16
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

And looks it is known issue.

ref webpack/webpack#14532 (comment)

And this StackOverflow's answers are well described how we can avoid this issue. (and downgrading to v16 or use legacy provider are not the best solution for the long term though)

node.js - Error message "error:0308010C:digital envelope routines::unsupported" - Stack Overflow https://stackoverflow.com/questions/69692842/error-message-error0308010cdigital-envelope-routinesunsupported

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions