Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install and run Yarn as local user (without admin rights)? [duplicate]

I'm using Windows as a simple user (I don't have any admin rights) and want to install Yarn and use commands like Yarn Install, Yarn Add and Yarn Start.

I found this on Stackoverflow about how to install Node.JS as a local user but I cannot make it work outside that folder: install NodeJS LTS on Windows as a local user (without admin rights)

I now have Node unpacked in the folder: C:\Users\USERNAME\Applications\node and I have added it my path to my variables using: rundll32 sysdm.cpl,EditEnvironmentVariables. I can run node -v and npm -v and it works. I have installed Yarn using npm install --global yarn but I cannot make it work outside of that folder.

I want to go to D:\projects\projectName\app-dev and run Yarn Install to install dependencies from a project I cloned from GitHub. How do I make it work?

UPDATE! For anyone out there the issue was not with Yarn. It was actually with Node.JS and the PATH in environment variable. For whatever reason until I restarted my computer the PATH did not update to include the new location of Node.JS. Make sure you read the answer from this question and you should not have any issues. install NodeJS LTS on Windows as a local user (without admin rights)

like image 929
milotindragos Avatar asked Mar 06 '18 13:03

milotindragos


2 Answers

You might be able to install Yarn locally with

  1. npm i -S yarn and then
  2. add it to your path SET PATH=%PATH%;c:\to\your\project\node_modules\.bin\yarn

Now in the same terminal window you can use it with yarn install ...

like image 71
Highmastdon Avatar answered Sep 26 '22 03:09

Highmastdon


Execute npm bin -g which will print the folder name where npm installs executables and add that folder to your path. Restart the command prompt/powershell and it should work.

like image 42
Strelok Avatar answered Sep 26 '22 03:09

Strelok