Yarn: Yarn reinstall fork to original module on install and on add every new module

Created on 2 Jul 2017  ·  3Comments  ·  Source: yarnpkg/yarn

Current Behaviour and how to reproduce

I'm forked react-native-elements and made few patches for it. Then I added it to my project by yarn add a/react-native-elements. In package.json I also have a/react-native-elements. All works good till add any other module to project.

After I'm adding any other module into my project, my fork is replaced to original repository I forked. There is no patches. In package.json I see a/react-native-elements anyway. ¯_(ツ)_/¯

Steps to reproduce

mkdir test && cd $_
yarn init
yarn add a/react-native-elements
cat node_modules/react-native-elements/src/swipedeck/SwipeDeck.js| grep "ignore touch" # ok
yarn add co
cat node_modules/react-native-elements/src/swipedeck/SwipeDeck.js| grep "ignore touch" # nothing

both yarn install and rm -rf node_modules && yarn install doesn't help. I can fix it only by install fork again by yarn add a/react-native-elements.

Expected behaviour

  1. It shouldn't change source code from a/react-native-elements to react-native-elements when install any other modules
  2. Both yarn install and rm -rf node_modules && yarn install should respect fork path from package.json.

Env

$ node -v 
v6.11.0
$ yarn -v
yarn install v0.24.5
[1/4] 🔍  Resolving packages...
success Already up-to-date.
✨  Done in 0.21s.

Sorry if you already have this issue. I have no idea about keywords to find it

Most helpful comment

I just had the same issue, yarn cache clean solved it, but I feel we shouldn't be required to clear the cache in this situation... 🤔

All 3 comments

As I got this issue is related to incorrect cache. By some reasons PackageLinker is copying wrong cache folder on each Install. I can't reproduce issue after yarn cache clean.

diff --git a/src/package-linker.js b/src/package-linker.js
index f17eff15..7c4e4e08 100644
--- a/src/package-linker.js
+++ b/src/package-linker.js
@@ -201,6 +201,7 @@ export default class PackageLinker {
         if (hardlinksEnabled) {
           copiedSrcs.set(src, dest);
         }
+        console.log(dest,src,type);
         copyQueue.set(dest, {
           src,
           dest,
$ /Users/a8ka/Projects/yarn/bin/yarn add co | grep -v react-native-elements/node_modules | grep react-native-elements
/Users/a8ka/Desktop/test/node_modules/react-native-elements /Users/a8ka/Library/Caches/Yarn/v1/npm-react-native-elements-0.13.0

I just had the same issue, yarn cache clean solved it, but I feel we shouldn't be required to clear the cache in this situation... 🤔

I still have this issue on yarn 1.18.0

Was this page helpful?
0 / 5 - 0 ratings