react-suspense icon indicating copy to clipboard operation
react-suspense copied to clipboard

Remove --openssl-legacy-provider from package.json

Open Nargonath opened this issue 3 years ago • 3 comments
trafficstars

I don't know why this option was added but it's preventing me from running npm run setup --silent. It crashes with this:

➜  7-react-suspense git:(main) npm run setup --silent
▶️  Starting workshop setup...
      Running the following command: npx "https://gist.github.com/kentcdodds/bb452ffe53a5caa3600197e1d8005733" -q
    ▶️  Starting: System Validation
          Ensuring the correct versions of tools are installed on this computer.
          Running the following command: npx "https://gist.github.com/kentcdodds/abbc32701f78fa70298d444c2303b6d9"
    ✅  Success: System Validation


    ▶️  Starting: Dependency Installation
          Installing third party code dependencies so the workshop works properly on this computer.
          Running the following command: npm install --legacy-peer-deps --no-save
    ✅  Success: Dependency Installation


    ▶️  Starting: Project Validation
          Running validation checks to ensure dependencies were installed properly
          Running the following command: npm run validate -s
/home/someUser/.nvm/versions/node/v16.15.1/bin/node: bad option: --openssl-legacy-provider
    🚨  Failure: Project Validation. Please review the messages above for information on how to troubleshoot and resolve this issue.

I run: [email protected] and [email protected].

Nargonath avatar Sep 12 '22 18:09 Nargonath

I think it fails with Node v18 (it was added due to webpack issues). I wonder if there's a way to use cross-env and set this option as an env variable so it works with both versions 🤔

kentcdodds avatar Sep 13 '22 20:09 kentcdodds

I thought of NODE_OPTIONS but this will be picked up no matter what version of node you're running thus causing errors on node < 17. It's not mention in node's documentation whether it can be set through a dedicated env var though: https://nodejs.org/dist/latest-v18.x/docs/api/cli.html#--openssl-legacy-provider.

Perhaps a custom script that checks the current node version and sets the command line argument based on whether node version is < 17 or not.

Edit: Maybe we can use a shell if condition for that: https://stackoverflow.com/questions/18766678/running-npm-scripts-conditionally/35594510#35594510. It complexifies the npm script though or we can write an external script for it.

Nargonath avatar Sep 14 '22 06:09 Nargonath

I think a simple script in the scripts directory would be a good idea.

kentcdodds avatar Sep 14 '22 18:09 kentcdodds

Due to the fact that Node < 18 is no longer lts, I think we can safely close this.

kentcdodds avatar Sep 20 '23 15:09 kentcdodds