'Yarn lock file resource source changed from registry.yarnpkg.com to registry.npmjs.org
I recently npm installed a package into my Ruby on Rails application. The installation changed my yarn.lock file. Specifically, the "resolved" field for all my resources have changed from yarnpkg.com to npmjs.org.
From this:
d3-dsv@1:
version "..."
resolved "https://registry.yarnpkg.com/d3-dsv/-/d3-dsv-1.0.8.tgz#..."
integrity ...
To this:
"d3-dsv@1":
"integrity" "..."
"resolved" "https://registry.npmjs.org/d3-dsv/-/d3-dsv-1.1.1.tgz"
"version" "..."
Is there a problem with these changes in this yark.lock file? Should I have done some yarn alternate to npm installing?
Solution 1:[1]
You can fix this issue by re-running yarn
again.
To accomplish this, follow the steps below.
Remove the registry.npmjs.org section in your
yarn.lock
file.Run the
yarn
command again.$ yarn
This should rewrite the
yarn.lock
to change the registry from npm to Yarn.
The steps above should rewrite the yarn.lock
file, and change the registry and text from npm to Yarn.
Solution 2:[2]
If you are using only public packages in your application then this will not cause many problems. You can go about your business as it is.
Although there might be some complications when you authenticate for any of them at any point.
If you are using any private repositories, you have to re-register your packages with yarn
and add credentials to them.
The following steps will help you.
- Setup a private repo on npmjs.org and add a scope and your package (Lets name it
boo
) - Create a new project locally and upload it to the npm registry (let's call it
blimp
) - So when they are updated it will be
@boo/blimp
- Add the package to your new applications
package.json
by installingyarn add @boo/blimp
- Remove the
node_modules
(rm -rf node_modules
) - Try
yarn install
if there is an error in the lock file try re-creating one as follows
sed -ie 's,registry.yarnpkg.com/@boo,registry.npmjs.org/@boo,' yarn.lock 7. If that omits an issue like
Request failed
or something in that alley, try following yarn config set registry https://registry.npmjs.org
At this point, you have tried lots of options. If this is still an issue in your system then you might have to move to `npm` package management. Follow the [yarn][2] repository for more updates.
Similar issues
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Arnav Thorat |
Solution 2 | Pulasthi Aberathne |