Not able to run any yarn cmd even after installing it - macos

I was using lerna yarn workspaces to manage the my monorepos but due to dependencies incompatible version issues i downgraded my yarn version and after that yarn cmds start failing. Then i again upgraded my yarn version to latest 1.22.10 but after that no yarn cmd is running. running any cmd gives below error attached in SS:
Can someone help me in this, i have tried multiple times reinstalling node, nvm and yarn but nothing is working for me.
I have tried downloading yarn using brew, npm globally but nothing works

Finally, after slogging for past 2 days and searching insanely online. Able to resolve this by hit and trial.
If you have yet to install or see yarn at /.yarn/ you can install it directly following https://classic.yarnpkg.com/en/docs/install/ or
curl -o- -L https://yarnpkg.com/install.sh | bash
Then follow below steps:-
mkdir ~/.yarn/releases/
cp ~/.yarn/lib/cli.js ~/.yarn/releases/yarn-1.19.0.cjs
yarn -v
voila, it works, Never been so happy before

Related

Yarn installation on windows

I am trying to upgrade yarn package on windows by doing npm install -g yarn but it keeps coming back with the following comments:
changed 1 package, and audited 3 packages in 996ms
found 0 vulnerabilities
What does it mean and anyone has a solution?
If you want to upldate yarn then you have to run:
npm i -g yarn#latest
After this command try to run:
yarn -v
If you see it is showing old version then reboot your computer and check the version again. Hopefully it will help you.
Note if you install yarn via npm on windows for security reasons you can't use yarn using Powershell unless you turn off the Powershell security. But you can use the cmd to run yarn commands. So I'd suggest you to use cmd instead of turning off Powershell security

Attempting to use Sanity.io CLI results in 'zsh: command not found'

I am having a problem running Sanity's CLI. I have installed the CLI with npm install -g #sanity/cli which works without a problem, and everything is installed correctly (as far as I can tell).
However, trying to use any of their CLI instructions, such as sanity init, I get this error message:
zsh: command not found: sanity
I am using npm version 6.14.11 and node version v14.16.0.
I've also been noticing a few random commands return the same zsh: command not found for various packages.
with npx it works
npx #sanity/cli init
#user1934428 is right.
I just change in the command "sanity ..." to "usr/local/Cellar/node/16.3.0/lib/node_modules/#sanity/cli/bin/sanity ..." and it worked
I had a similar problem on my mac which was caused by not installing sanity globally.
Go to your terminal and enter:
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
Enter your password then install sanity globally
npm install -g ng
This should solve the issue and sanity commands should work too.

Firebase command not found days after having already successfully used it

I am trying to use the 'firebase' command from my Mac terminal to deploy firebase cloud functions using 'firebase deploy --only functions'. I just used this command a week or two ago when I updated my firebase-functions and firebase-tools to version 3.18.4 but now everytime I try to use the 'firebase' keyword to run a command it says -bash: firebase: command not found. When I run npm -g list I see that I have firebase, firebase-tools and more in that list.
I've tried running 'npm install -g firebase-tools` but it still doesn't work. Also I tried what is recommended in this question
but still not working. Any advice would be great, thanks
First I ran npm get prefix which should output something like /Users/username/.npm-packages. Then I had to add the following to my $PATH variable
export PATH="/Users/username/.npm-packages/bin:$PATH"
Note the extra /bin (after the result of npm get prefix)
And I also added
export PATH="/usr/local/share/npm/bin:/usr/local/bin:/usr/local/sbin:~/bin:$PATH$
Then you must activate the changes to your bash_profile by running source ~/.bash_profile
Once I did this the firebase command is again globally recognized
Try the following in your terminal:
curl -sL https://firebase.tools | bash
This will check the OS of your machine and then install everything else automatically and properly.
The command is from the official Firebase Documentation.
I've just fallen into the same issue. My case was in different node versions a) when installing firebase globally, b) when using it during next session. I'm using nvm and my default was node v10, but I installed firebase on node v12. So after restart I got node v10. When I realised it, I switched nvm default from v10 to v12:
$ nvm alias default v12.13.1
And firebase started working.
For those who use yarn instead of npm to manage global packages, yarn seems to place binaries in isolated directory as symbolic links.
In my case, I did yarn bin to look for where binaries are, turned out it is $HOME/.config/yarn/global/node_modules/.bin. So, I set it to .bashrc. Now it's working.

how to update yarn if I install through windows installer?

I have installed yarn via windows installer sometimes back. Now I want to update it to latest version. How can I do that?
The following worked for me:
npm i -g yarn
Just download the new installer and rerun the setup.
choco upgrade yarn -y
open powershell as administrator
run choco upgrade yarn -y
I stumble across this minutes ago, searching on the docs I found nothing but 'yarn self-update', I don't know if this is a deprecated command, but themselves do not recommend it. so I looked for the install options and it give the Chocolatey package. So just upgrade via it.

Hadoop showing old version despite latest version installation

I am trying to install hadoop in my ubuntu OS. I followed each and every step exactly from this link Hadoop Install Tutorial and everything was going as expected until i tried to run
$ start-dfs.sh and $ hadoop jar ./share/hadoop/mapreduce/hadoop-mapreduce-examples-2.2.0.jar pi 2 5 command. These commands doesn't work as expected.I tried R&D and somehow came to know that i was using older hadoop version Hadoop 1.0.2 despite of me getting latest 2.2.0 version.
As i could not solve this, i tried to uninstall hadoop completely, Now when i try doing it, it says
$ sudo dpkg -r hadoop
dpkg: dependency problems prevent removal of hadoop:
hadoop-native depends on hadoop (= 1.0.2-0ubuntu1~hadoop1).
dpkg: error processing hadoop (--remove):
dependency problems - not removing
Errors were encountered while processing:
hadoop
Appreciate any help !
I dont know whether its a proper way to remove hadoop or not, but i have removed it using below method.
I first manually deleted the /usr/local/hadoop folder from all the users(If any).If you are not able to remove it due to lack of permissions, then make sure about the permissions of the folder. Make the permission of the folder to "Sudo" and on "Creating and deleting files" so that every user can delete from their instances.
Then from Terminal $ rm -r hadoop does the job going to the /usr/local path.
After this, i checked $ hadoop version again in terminal ..and boom it again showed its existence. Then i did below step.
2.Goto terminal sudo apt-get purge hadoop or sudo apt-get remove hadoop...then it worked

Resources