Home > Blockchain >  Unable to install yarn through npm
Unable to install yarn through npm

Time:07-26

I am trying to install yarn through npm on Mac by referring the documentation given here: https://classic.yarnpkg.com/lang/en/docs/install/#mac-stable

npm install --global yarn

However when I run this command in terminal, I am getting the following error and the package is not being installed

npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.

I also ran this command but nothing happened. I am also seeing messages like - this operation was rejected by your operating system. I haven't used yarn in a year, and everything was working fine, but suddenly I am running into all this. Would love to know what I am doing wrong here and how I can resolve this.

This the error message that comes

The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

CodePudding user response:

As warning messages indicate, global -global and -local appear to be deprecated. However, instead of global, you can use the -location=global command. -global and -local is deprecated.

  • Use This Command

    npm install --location=global create-react-app

  • Instead of

    npm install -g create-react-app

I Hope Your Probleme Will solving.

CodePudding user response:

sudo npm install --location=global yarn

This command worked for me

  • Related