yarn commands are not working on node v18 with macbook

287 views Asked by At

I'm using nvm to switch between node versions. When I choose node v16, yarn is working fine on my Macbook. But when I switch to node v18 using nvm I'm getting this error.

yarn install v1.22.19
info No lockfile found.
[1/5]   Validating package.json...
[2/5]   Resolving packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
error An unexpected error occurred: "https://registry.yarnpkg.com/@react-native-async-storage%2fasync-storage: ETIMEDOUT".
info If you think this is a bug, please open a bug report with the information provided in "/Volumes/External/CodeScale/xdotenrich/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Even sudo npm install --globle yarn --force is not working!

 % sudo npm install --global yarn --force
npm WARN using --force Recommended protections disabled.
(⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂) ⠦ idealTree:lib: sill idealTree buildDeps

Does anyone know how to resolve this error?

1

There are 1 answers

0
Lakpriya Senevirathna On

Found a quick fix, you can run these commands in your terminal!

On macOS terminal:

export NODE_OPTIONS=--openssl-legacy-provider

On Windows command prompt:

set NODE_OPTIONS=--openssl-legacy-provider

On PowerShell:

$env:NODE_OPTIONS = "--openssl-legacy-provider"