Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to fix - Error: error:0308010C:digital envelope routines::unsupported - command(npm run dev) #56

Open
straxxxes opened this issue Jan 19, 2023 · 4 comments

Comments

@straxxxes
Copy link

ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - Loaded env from D:\coding projects\project_graphql_blog.env
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:71:19)
at Object.createHash (node:crypto:133:10)
at BulkUpdateDecorator.hashFactory (D:\coding projects\project_graphql_blog\node_modules\next\dist\compiled\webpack\bundle5.js:138971:18)
at BulkUpdateDecorator.update (D:\coding projects\project_graphql_blog\node_modules\next\dist\compiled\webpack\bundle5.js:138872:50)
at OriginalSource.updateHash (D:\coding projects\project_graphql_blog\node_modules\next\dist\compiled\webpack-sources3\index.js:1:10264)
at NormalModule._initBuildHash (D:\coding projects\project_graphql_blog\node_modules\next\dist\compiled\webpack\bundle5.js:68468:17)
at handleParseResult (D:\coding projects\project_graphql_blog\node_modules\next\dist\compiled\webpack\bundle5.js:68534:10)
at D:\coding projects\project_graphql_blog\node_modules\next\dist\compiled\webpack\bundle5.js:68628:4
at processResult (D:\coding projects\project_graphql_blog\node_modules\next\dist\compiled\webpack\bundle5.js:68343:11)
at D:\coding projects\project_graphql_blog\node_modules\next\dist\compiled\webpack\bundle5.js:68407:5
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:133:10)
at BulkUpdateDecorator.hashFactory (D:\coding projects\project_graphql_blog\node_modules\next\dist\compiled\webpack\bundle5.js:138971:18)
at BulkUpdateDecorator.update (D:\coding projects\project_graphql_blog\node_modules\next\dist\compiled\webpack\bundle5.js:138872:50)
at OriginalSource.updateHash (D:\coding projects\project_graphql_blog\node_modules\next\dist\compiled\webpack-sources3\index.js:1:10264)
at NormalModule._initBuildHash (D:\coding projects\project_graphql_blog\node_modules\next\dist\compiled\webpack\bundle5.js:68468:17)
at handleParseResult (D:\coding projects\project_graphql_blog\node_modules\next\dist\compiled\webpack\bundle5.js:68534:10)
at D:\coding projects\project_graphql_blog\node_modules\next\dist\compiled\webpack\bundle5.js:68628:4
at processResult (D:\coding projects\project_graphql_blog\node_modules\next\dist\compiled\webpack\bundle5.js:68343:11)
at D:\coding projects\project_graphql_blog\node_modules\next\dist\compiled\webpack\bundle5.js:68407:5
node: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 BulkUpdateDecorator.hashFactory (D:\coding projects\project_graphql_blog\node_modules\next\dist\compiled\webpack\bundle5.js:138971:18)
at BulkUpdateDecorator.update (D:\coding projects\project_graphql_blog\node_modules\next\dist\compiled\webpack\bundle5.js:138872:50)
at OriginalSource.updateHash (D:\coding projects\project_graphql_blog\node_modules\next\dist\compiled\webpack-sources3\index.js:1:10264)
at NormalModule._initBuildHash (D:\coding projects\project_graphql_blog\node_modules\next\dist\compiled\webpack\bundle5.js:68468:17)
at handleParseResult (D:\coding projects\project_graphql_blog\node_modules\next\dist\compiled\webpack\bundle5.js:68534:10)
at D:\coding projects\project_graphql_blog\node_modules\next\dist\compiled\webpack\bundle5.js:68628:4
at processResult (D:\coding projects\project_graphql_blog\node_modules\next\dist\compiled\webpack\bundle5.js:68343:11)
at D:\coding projects\project_graphql_blog\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 v18.13.0

@hungnhu95
Copy link

I got same error when I build the production on Vercel

image

@hungnhu95
Copy link

I found a solution for this issue by edit file package.json, see picture below. My production is running now

image

@izhar360
Copy link

izhar360 commented Feb 12, 2023

this explains the reason and some solutions for it but the best one is downgrading your npm version to 16.

You can downgrade the Node.js version for a specific project on Windows. This can be done by using a version manager such as nvm (Node Version Manager).

Here's how you can do it:

  1. Install nvm: You can install nvm by following the instructions on the official GitHub page: https://github.com/coreybutler/nvm-windows (nvm-setup.exe)

  2. List available Node.js versions: Once nvm is installed, you can list all the available Node.js versions by running the following command in your Command Prompt: nvm list available

  3. install the desired Node.js version: To install a specific version, run the following command: nvm install [version number] (e.g., nvm install 16 --lts)

4.Use the desired Node.js version for your project: To use the specific version for your project, navigate to your project directory and run the following command: nvm use [version number]

After following these steps, the desired version of Node.js will be used for your project, while the system-wide version will remain unchanged.

this fixes #56

@SiddhantMalik
Copy link

Enable legacy OpenSSL provider.

On Unix-like (Linux, macOS, Git bash, etc.):

export NODE_OPTIONS=--openssl-legacy-provider

On Windows command prompt:

set NODE_OPTIONS=--openssl-legacy-provider

On PowerShell:

$env:NODE_OPTIONS = "--openssl-legacy-provider"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants