Closed trakanom closed 1 year ago
Error log:
$ yarn build
yarn run v1.22.19
$ yarn run react-scripts build
$ ...\Portfolio-Site\node_modules\.bin\react-scripts build
Creating an optimized production build...
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:69:19)
at Object.createHash (node:crypto:133:10)
at module.exports (...\Portfolio-Site\node_modules\webpack\lib\util\createHash.js:135:53)
at NormalModule._initBuildHash (...\Portfolio-Site\node_modules\webpack\lib\NormalModule.js:417:16)
at handleParseError (...\Portfolio-Site\node_modules\webpack\lib\NormalModule.js:471:10)
at ...\Portfolio-Site\node_modules\webpack\lib\NormalModule.js:503:5
at ...\Portfolio-Site\node_modules\webpack\lib\NormalModule.js:358:12
at ...\Portfolio-Site\node_modules\loader-runner\lib\LoaderRunner.js:373:3
at iterateNormalLoaders (...\Portfolio-Site\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
at iterateNormalLoaders (...\Portfolio-Site\node_modules\loader-runner\lib\LoaderRunner.js:221:10)
at ...\Portfolio-Site\node_modules\loader-runner\lib\LoaderRunner.js:236:3
at runSyncOrAsync (...\Portfolio-Site\node_modules\loader-runner\lib\LoaderRunner.js:130:11)
at iterateNormalLoaders (...\Portfolio-Site\node_modules\loader-runner\lib\LoaderRunner.js:232:2)
at Array.<anonymous> (...\Portfolio-Site\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
at Storage.finished (...\Portfolio-Site\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
at ...\Portfolio-Site\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
...\Portfolio-Site\node_modules\react-scripts\scripts\build.js:19
throw err;
^
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:69:19)
at Object.createHash (node:crypto:133:10)
at module.exports (...\Portfolio-Site\node_modules\webpack\lib\util\createHash.js:135:53)
at NormalModule._initBuildHash (...\Portfolio-Site\node_modules\webpack\lib\NormalModule.js:417:16)
at ...\Portfolio-Site\node_modules\webpack\lib\NormalModule.js:452:10
at ...\Portfolio-Site\node_modules\webpack\lib\NormalModule.js:323:13
at ...\Portfolio-Site\node_modules\loader-runner\lib\LoaderRunner.js:367:11
at ...\Portfolio-Site\node_modules\loader-runner\lib\LoaderRunner.js:233:18
at context.callback (...\Portfolio-Site\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
at ...\Portfolio-Site\node_modules\babel-loader\lib\index.js:59:103 {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
Node.js v18.18.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Attempted resolution with npm_config_yes=true npx yarn-audit-fix
as per reference link to little effect.
Issue Title: Build Failure Due to SSL Error with Node.js v18.18.0
Issue Description:
When attempting to build the project using
yarn build
, the process fails and throws an SSL-related error:error:0308010C:digital envelope routines::unsupported
. This issue is observed while using Node.js versionv18.18.0
.Error Details:
Context:
yarn build
ERR_OSSL_EVP_UNSUPPORTED
Reason for the Error:
The error is related to a breaking change in Node.js v17 and later, where developers patched a security vulnerability in the SSL provider. This change is incompatible with certain SSL packages in NPM if they are not updated accordingly. When SSL is utilized in Node.js v17+ without upgrading the relevant SSL packages in
package.json
, the aforementioned error is encountered.Reference: StackOverflow Explanation
Suggested Fix:
1. Downgrade Node.js:
2. Update SSL-related Dependencies:
package.json
are updated to versions that support the changes in Node.js v17+.yarn upgrade
to update the dependencies and retry the build.3. Alternative Node Version Management:
nvm
(Node Version Manager) to manage and easily switch between different Node.js versions, ensuring compatibility with different projects.Steps to Reproduce:
yarn install
to install dependencies.yarn build
.Expected Result:
Actual Result:
Additional Notes:
node_modules
and reinstall dependencies after changing Node.js versions.Attachments:
Feel free to adjust the details as per your project’s requirement and add any additional information that might be relevant to understanding and resolving the issue.