Yarn keeps using old registry - yarnpkg

I've been using yarn with a private registry in the past - however, the registry has now shut down and I want to use yarn with the official registry.
Whatever I do, yarn always seems to want to connect to the old registry and there's simply no way of making it use the new one. I've already tried:
Completely remove and re-install yarn
yarn config set registry https://registry.yarnpkg.com/
Verified that there is no mention of the old registry in either ~/.npmrc or ~/.yarnrc
Cleared the yarn cache using yarn cache clean
No matter what I do, yarn still tries to connect to the old registry on every install and I have no idea where yarn is getting that from...
any ideas?

Remove your global yarn.lock
rm ~/.config/yarn/global/yarn.lock
and then
yarn config set registry https://registry.yarnpkg.com/

Got it, the culprit was ~/.config/yarn/global/yarn.lock...

Running yarn add with --verbose will tell you which .yarnrc files are being picked up. These shouldn't include the old registry.
So run yarn add <your-package> --verbose and check the .yarnrc files found for any mention of the old registry.

In my case, I got it fixed with a rm ~/.npmrc running MacOS

Related

How do I get yarn 2 to work in my project?

I cd into my project and run yarn set version berry. It creates the .yarnrc.yml with the yarnPath variable. However, if I do run yarn inside the dir it still defaults to the old Yarn. I made a Makefile with commands like ./.yarn/releases/yarn-berry.cjs + install or start to get Yarn 2 to work. What am I doing wrong?
You have .yarnrc or .yarnrc.yml file in your home directory or in some of the parent folders Yarn 1 finds it and Yarn 2.x never gains control, search for it and remove.

How can I verify Yarn's integrity checks actually work?

I cannot figure out how to determine if Yarn's integrity checks actually do anything. There is not a lot of documentation.
I've tried modifying integrity hashes to be bogus ones in yarn.lock and then trying to yarn install or run yarn check --integrity. Neither of these commands fail, so how is Yarn actually checking the integrity of packages?
After some discussion with the Yarn devs on Discord, it looks like Yarn won't check integrity on yarn install unless there is actually something to install, so my test wasn't sufficient to trip over the errors.
You'll also need to be on Yarn 1.19.1 or later because of some caching bugs.
Apparently, yarn check is being removed so that's not a reliably way to check integrity.

Yarn (Binary) Offline installation on Centos 7

How do i install Yarn (binary) offline on Centos 7. The machine doesn't have internet. Apologise if the question has been asked before.
I couldn't find it anywhere. All Questions point to using Yarn in offline mode but not how to install it offline at the first place.
Finally, i managed to do it via tarball (Note this is Linux installation).
You can install Yarn by downloading a tarball and extracting it anywhere.
cd /opt
wget https://yarnpkg.com/latest.tar.gz
tar zvxf latest.tar.gz
Yarn is now in /opt/yarn-[version]/
the following steps will add Yarn to path variable and run it from anywhere.
Note: your profile may be in your .profile, .bash_profile, .bashrc, .zshrc, etc.
Add this to your profile:
export PATH="$PATH:/opt/yarn-[version]/bin"
(the path may vary depending on where you extracted Yarn to)
In the terminal, log in and log out for the changes to take effect
To have access to Yarn’s executables globally, you will need to set up the PATH environment variable in your terminal. To do this, add
export PATH="$PATH:`yarn global bin`"
to your profile.
Here is the link i found it
Although Yarn can work in offline mode, the packages must be downloaded and stored in the in an offline mirror. Refer to this article.
Your Centos machine will need to be connected to another machine that has access to the Internet. The most common solution is to set up a http/https proxy, then set up yarn to use the proxy
yarn config set proxy http://proxy.server.com:8080
yarn config set https-proxy http://proxy.server.com:8080

MODULE_NOT_FOUND in heroku pg:backups

I've got problem with heroku pg:backups capture --app myapp command.
Heroku CLI submits usage information back to Heroku. If you would like to disable this, set `skip_analytics: true` in /home/ubuntu/.heroku/config.json
heroku-cli: Updating to 4.99.0-e5f5ef4... done
heroku-cli: Updating CLI...heroku-cli: Updating to 5.11.8-f58f4fa... done
Starting backup of postgresql-spherical-5948... done
Use Ctrl-C at any time to stop monitoring progress; the backup will continue running.
Use heroku pg:backups:info to check progress.
Stop a running backup with heroku pg:backups:cancel.
Backing up DATABASE to b598... pending
Backing up DATABASE to b598... !
▸ MODULE_NOT_FOUND: Cannot find module 'bytes'
Does anybody have similar problem? This command is launched with deploy on CircleCI.
I started running into the same problem yesterday and was finally able to come up with a solution that is working for me.
For starters, it looks like bytes is a dependency of heroku-pg, which is the part of Heroku CLI that is being used for the backups command. It seems like the dependency is not being included or installed with the version of heroku-cli that is being used to run the backup command.
I tried CircleCI’s “Rebuild with SSH” to troubleshoot the issue, and encountered similar error messages when attempting the backup command there. While trying to reinstall heroku-cli using npm, I found that the npm and node versions were way behind what heroku-cli wanted, so maybe that is part of the problem? Anyway, reinstalling with npm only produced an even more broken Heroku CLI.
Finally I checked the build environment and it was set to Ubuntu 12.04 (Precise) which probably explains the way out of date npm/node packages. I changed it to Ubuntu 14.04 (Trusty) and pushed a new commit to CircleCI (A rebuild alone is not sufficient to change OS versions) and was able to successfully run the backup command that had been failing!
Solution: Set CircleCI build environment to Ubuntu 14.04

npm hangs on any command

I installed last version of Node.js (12.2 x64 windows)
After I run cmd as administrator and try to call any npm command (except npm -v), cmd window is hanging. After Ctrl+C it returns
Terminate batch job (Y/N)?
I was trying to left cmd for several hours but it didn't give some results.
It is strange because node.exe process is consuming CPU and memory quite hard.
I was trying to reinstall node.js several times without success.
I can't even get some debug information.
I faced such issue on my VM which I was using by connecting via rdp. Same version installed on my laptop works ok. On my VM I had Kaspersky antivirus, but after switching it off I got same result.
Did somebody face such issue? Is there some way to get more information problem?
Could you please recommend me some way to resolve?
I've finally resolved my issue.
According to suggestion from our local read me file
Node.js (with NPM) Note: On windows server machines, instead of node modules been installed at user %APPDATA% path, its better to install at a global path e.g c:\npm. This could be acheived by the npm command: $ npm config set prefix 'c:\npm' This is not required on individual developer's machine.
I've executed npm config set prefix 'c:\npm'.
As result it added prefix="'c:\\npm'" to my .npmrc file
This make node.js really crazy. It takes me about an hour to debug all these js scripts npm.js code.js etc... to find that it calls mkdirp with 'c:\\npm'\etc and it loop process forever.
If anyone will encounter this problem in the future you need to find the npmrc file delete it and delete all configurations for node, delete node as well and install it, this should fix that.
when deleting node some of the configurations aren't deleted so you have to delete it manually.
It happenned for me too : I installed node only for my user on Windows 10, and managed to use npm by calling it using the full path "c:\Program Files\nodejs\npm"
I solved by using "c:\Program Files\nodejs\npm" config set prefix "c:\Program Files\nodejs" (setting the prefix to the full path to npm)
And the result was :
λ cat c:\Users\<my_user_name>\.npmrc
prefix=c:\Program Files\nodejs
Now eveything works fine.
It's if the prefix is not set correctly.
Just want to point out to those commenting -if you can't get access to the command line npm, then you can't run npm config, obviously.
Open up powershell and type notepad $HOME/.npmrc, and edit the line where it says prefix=... and change it to a valid one.
For clarity, when you call:
npm config set prefix 'c:\npm'
you are required to have the ' wrapping the path, but you need to remove them from the .npmrc file so that npm commands will work. So your resulting line in .npmrc file should look like:
prefix="c:\\npm"
Just delete the .nprmc file at User/%UserProfile% and now try the command if it dosents work even reinstall once.

Resources