adrianhajdin / project_graphql_blog

With featured and recent posts, categories. full markdown articles, author information, comments, and much more, this fully responsive CMS Blog App is the best Blog Application that you can currently find on YouTube. And what's best of all is that you and your clients can manage the blog from a dedicated Content Management System.
https://jsmastery.pro
1.47k stars 347 forks source link

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

Open straxxxes opened 1 year ago

straxxxes commented 1 year ago

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 commented 1 year ago

I got same error when I build the production on Vercel

image

hungnhu95 commented 1 year ago

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

image

izhar360 commented 1 year ago

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 commented 1 year ago

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"