gridsome error:03000086:digital envelope routines::initialization error

When starting a gridsome project on Ubuntu 20.04 with Node.js version v18.10.0, it failed with the error message “error:03000086:digital envelope routines::initialization error”.

boby@sok-01:~/www/learn/gridsome/my-gridsome-site$ gridsome develop
Gridsome v0.7.23

Initializing plugins...
Load sources - 0s
Create GraphQL schema - 0.03s
Create pages and templates - 0.03s
Generate temporary code - 0.03s
Bootstrap finish - 0.56s
10% building 1/1 modules 0 activeError: 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 (/mnt/data/sites/learn/gridsome/my-gridsome-site/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/mnt/data/sites/learn/gridsome/my-gridsome-site/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/mnt/data/sites/learn/gridsome/my-gridsome-site/node_modules/webpack/lib/NormalModule.js:471:10)
    at /mnt/data/sites/learn/gridsome/my-gridsome-site/node_modules/webpack/lib/NormalModule.js:503:5
    at /mnt/data/sites/learn/gridsome/my-gridsome-site/node_modules/webpack/lib/NormalModule.js:358:12
    at /mnt/data/sites/learn/gridsome/my-gridsome-site/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/mnt/data/sites/learn/gridsome/my-gridsome-site/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at iterateNormalLoaders (/mnt/data/sites/learn/gridsome/my-gridsome-site/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
    at /mnt/data/sites/learn/gridsome/my-gridsome-site/node_modules/loader-runner/lib/LoaderRunner.js:236:3
    at runSyncOrAsync (/mnt/data/sites/learn/gridsome/my-gridsome-site/node_modules/loader-runner/lib/LoaderRunner.js:130:11)
    at iterateNormalLoaders (/mnt/data/sites/learn/gridsome/my-gridsome-site/node_modules/loader-runner/lib/LoaderRunner.js:232:2)
    at Array. (/mnt/data/sites/learn/gridsome/my-gridsome-site/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
    at Storage.finished (/mnt/data/sites/learn/gridsome/my-gridsome-site/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
    at /mnt/data/sites/learn/gridsome/my-gridsome-site/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
10% building 1/3 modules 2 active /mnt/data/sites/learn/gridsome/my-gridsome-site/node_modules/webpack/hot/dev-server.jsnode:internal/crypto/hash:71
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

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 (/mnt/data/sites/learn/gridsome/my-gridsome-site/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/mnt/data/sites/learn/gridsome/my-gridsome-site/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/mnt/data/sites/learn/gridsome/my-gridsome-site/node_modules/webpack/lib/NormalModule.js:471:10)
    at /mnt/data/sites/learn/gridsome/my-gridsome-site/node_modules/webpack/lib/NormalModule.js:503:5
    at /mnt/data/sites/learn/gridsome/my-gridsome-site/node_modules/webpack/lib/NormalModule.js:358:12
    at /mnt/data/sites/learn/gridsome/my-gridsome-site/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/mnt/data/sites/learn/gridsome/my-gridsome-site/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at Array. (/mnt/data/sites/learn/gridsome/my-gridsome-site/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
    at Storage.finished (/mnt/data/sites/learn/gridsome/my-gridsome-site/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
    at /mnt/data/sites/learn/gridsome/my-gridsome-site/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
    at /mnt/data/sites/learn/gridsome/my-gridsome-site/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'
}

Node.js v18.10.0
boby@sok-01:~/www/learn/gridsome/my-gridsome-site$ 

To fix the error, use the command

NODE_OPTIONS='--openssl-legacy-provider' gridsome develop

To make it permanent, you can edit the package.json file in the root directory of your gridsome project

Find

    "develop": "gridsome develop",

Replace with

    "develop": "NODE_OPTIONS='--openssl-legacy-provider' gridsome develop",

Now use

yarn develop

Or

npm run develop

Instead of the “gridsome develop” command.

Back to Node.js

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *