3

We had upgrade to node 17.4.0. After that Storybook started giving error on start:

Error: error:0308010C:digital envelope routines::unsupported

From what I found it's because we use 17.x node. But unfortunately we can't downgrade, so I wanted to have two versions of node and be able to switch between them depending on what I do. I installed 16.x node: nvm install v16.14.2 If I check currently used node version it will be 16.x, but when I run npm run storybook I see that it starts with version 17.x and fails. How can I setup my Storybook to be launching with version 16.x?

Alyona
  • 1,682
  • 2
  • 21
  • 44

3 Answers3

2

In your package.json: change this line. and have a look on this as well (https://itsmycode.com/error-digital-envelope-routines-unsupported/)

Check this out Getting error 'digital envelope routines', reason: 'unsupported', code: 'ERR_OSSL_EVP_UNSUPPORTED'

"start": "react-scripts start"

to

"scripts": {
    "start": "export SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts start",
    "build": "export SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts build"
}

or

"scripts": {
    "start": "react-scripts --openssl-legacy-provider start",
    "build": "react-scripts --openssl-legacy-provider build",
}
Milan Sachani
  • 335
  • 3
  • 8
  • didn't work for me – Alyona Apr 06 '22 at 12:21
  • it definitely should work can you show what error are you having in your terminal? – Milan Sachani Apr 06 '22 at 12:24
  • ` opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ], library: 'digital envelope routines', reason: 'unsupported', code: 'ERR_OSSL_EVP_UNSUPPORTED' }` – Alyona Apr 06 '22 at 12:24
  • I have edited the answer for you and have a look I have found one link maybe it could help. because in my it is working when I change to the "start": "export SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts start" – Milan Sachani Apr 06 '22 at 12:32
0

I had the same issue when upgraded from node v16 to v18. Looks like Storybook uses Webpack 4 by default, so you have to add Webpack 5 and change the Storybook config to use that. This solved the issue for me.

See here: https://github.com/storybookjs/storybook/issues/19692#issuecomment-1297542268

Szilvi
  • 1
  • 2
0

Add the snippet below to .storybook/main.js :

module.exports = {
  core: {
    builder: 'webpack5',
  },
};