Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yarn install --pure-lockfile deleting artifact folders for dependencies that already existed and were not reinstalled #3506

Closed
collinsauve opened this issue May 25, 2017 · 2 comments · Fixed by #3704

Comments

@collinsauve
Copy link

collinsauve commented May 25, 2017

What is the current behavior?

I have discovered some cases where some dependency artifact folders are deleted when running yarn install --pure-lockfile. In particular this affects node-sass for my day-job project if I have deleted some other node_modules/package-name folder. I have created a small repo that reproduces this problem.

If the current behavior is a bug, please provide the steps to reproduce.

Using this repo and the test.sh in there to reproduce: https://github.com/collinsauve/yarn-test-consumer.

git clone [email protected]:collinsauve/yarn-test-consumer.git
cd yarn-test-consumer
./test.sh

This uses a dependency (yarn-test-package)that creates preinstall, install, and postinstall folders when those steps are run. It also has a dependency on promisfy, just as a sample other dependency so that we can delete it from node_modules.

The tail of the output will be the following:

After initial install, these folders exist:
./node_modules/yarn-test-package/ ./node_modules/yarn-test-package/install ./node_modules/yarn-test-package/postinstall ./node_modules/yarn-test-package/preinstall
After second install, these folders exist:
./node_modules/yarn-test-package/

What is the expected behavior?

Tail of the output should be the following:

After initial install, these folders exist:
./node_modules/yarn-test-package/ ./node_modules/yarn-test-package/install ./node_modules/yarn-test-package/postinstall ./node_modules/yarn-test-package/preinstall
After second install, these folders exist:
./node_modules/yarn-test-package/ ./node_modules/yarn-test-package/install ./node_modules/yarn-test-package/postinstall ./node_modules/yarn-test-package/preinstall

Please mention your node.js, yarn and operating system version.

Node: v7.7.4
Yarn: v0.24.6
OS: Windows 10 v1607 (OS Build 14393.447)
GNU bash, version 4.3.46(2)-release (x86_64-pc-msys)

@bestander
Copy link
Member

Thanks for a good repro step

@mridgway
Copy link

I have found that just running yarn install --pure-lockfile twice will remove artifacts:

yarn init -y
yarn add grpc
rm -rf node_modules/
yarn install --pure-lockfile
ls node_modules/grpc/src/node/
yarn install --pure-lockfile
ls node_modules/grpc/src/node/

The first ls will contain extension_binary but the second it will be gone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants