Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set Storybook to run with different node version?

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?

like image 615
Alyona Avatar asked Nov 15 '25 09:11

Alyona


1 Answers

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",
}
like image 149
Milan Sachani Avatar answered Nov 18 '25 12:11

Milan Sachani