1

I can't start electron. "Error: error:0308010C:digital envelope routines::unsupported" appears

when typing npm run electron:serve

the error below appears:

 project-plugins@0.1.0 electron:serve

 vue-cli-service electron:serve

  INFOStarting development server...


  DONE Compiled successfully in 3002ms 17:26:56

   App running at:
   - Location: http://localhost:8080/
   - Network: http://192.168.3.10:8080/

   Note that the development build is not optimized.
   To create a production build, run npm run build.

- Bundling main process...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 module.exports (C:\Users\allan\Downloads\Projects\curso-vue\vue-cli\projeto-plugins\node_modules\vue-cli-plugin-electron-builder\node_modules\webpack\lib\util\createHash. js:135:53)
     at NormalModule._initBuildHash (C:\Users\allan\Downloads\Projects\curso-vue\vue-cli\projeto-plugins\node_modules\vue-cli-plugin-electron-builder\node_modules\webpack\lib\NormalModule.js: 417:16)
     at handleParseError (C:\Users\allan\Downloads\Projects\curso-vue\vue-cli\projeto-plugins\node_modules\vue-cli-plugin-electron-builder\node_modules\webpack\lib\NormalModule.js:471: 10)
     at C:\Users\allan\Downloads\Projects\curso-vue\vue-cli\projeto-plugins\node_modules\vue-cli-plugin-electron-builder\node_modules\webpack\lib\NormalModule.js:503:5
     at C:\Users\allan\Downloads\Projects\curso-vue\vue-cli\projeto-plugins\node_modules\vue-cli-plugin-electron-builder\node_modules\webpack\lib\NormalModule.js:358:12
     at C:\Users\allan\Downloads\Projects\curso-vue\vue-cli\projeto-plugins\node_modules\vue-cli-plugin-electron-builder\node_modules\loader-runner\lib\LoaderRunner.js:373: 3
     at iterateNormalLoaders (C:\Users\allan\Downloads\Projects\curso-vue\vue-cli\projeto-plugins\node_modules\vue-cli-plugin-electron-builder\node_modules\loader-runner\lib\LoaderRunner.js: 214:10)
     at Array.<anonymous> (C:\Users\allan\Downloads\Projects\curso-vue\vue-cli\projeto-plugins\node_modules\vue-cli-plugin-electron-builder\node_modules\loader-runner\lib\ LoaderRunner.js:205:4) {
   opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
   library: 'digital envelope routines',
   reason: 'unsupported',
   code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

I already tried to reinstall and install the latest node. I already installed an old version of node that in theory worked, but it led to several other problems, so I prefer to solve this with the latest LTS node version.

and also tried to install openSSL and crypto-browserify module

Luke Woodward
  • 63,336
  • 16
  • 89
  • 104

2 Answers2

1

There are two solutions:

Quick and Dirty

Upgrade webpack to version 5 by editing your package-lock.json file.

  • Go into your package-lock.json file and change all version 4.x.x webpacks to 5.0.0. (ctrl f and search for "webpack": "4 to find all version 4 webpacks)
  • Delete node modules and reinstall using npm i
Nathan
  • 36
  • 3
0

I had the same problem and the only thing that solved it was to uninstall node and install it again with version 16.12.0. You can also do this with nvm (Node Version Manager).

> nvm install 16.12.0 // to install the version I wanted

> nvm use 16.12.0  // use the installed version

Link to node version 16.6.0: link.
Link of the nvm repository: link.

You can access all versions of Node here.

If you still can't do it, try running CMD as administrator.

Vanortton
  • 51
  • 11