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 doesn't install if node_modules is present but in the wrong state #3223

Closed
seansfkelley opened this issue Apr 21, 2017 · 4 comments

Comments

@seansfkelley
Copy link

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

Removing packages that are listed in yarn.lock from node_modules without removing node_modules itself then running yarn install does not see Yarn reinstall the missing packages.

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

> mkdir test && cd test 

> npm init --yes 

<... snip ...>

> yarn add leftpad 
yarn add v0.23.2
info No lockfile found.
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 📃  Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
└─ leftpad@0.0.0
✨  Done in 0.61s.

> ls node_modules 
leftpad

> cat yarn.lock 
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


leftpad@^0.0.0:
  version "0.0.0"
  resolved "https://registry.yarnpkg.com/leftpad/-/leftpad-0.0.0.tgz#020c9ad0787216ba0f30d79d479b4b355d7d39c3"

> rm -rf node_modules/leftpad

> yarn install
yarn install v0.23.2
[1/4] 🔍  Resolving packages...
success Already up-to-date.
✨  Done in 0.17s.

> ls node_modules 

> cat yarn.lock 
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


leftpad@^0.0.0:
  version "0.0.0"
  resolved "https://registry.yarnpkg.com/leftpad/-/leftpad-0.0.0.tgz#020c9ad0787216ba0f30d79d479b4b355d7d39c3"

> rm -rf node_modules 

> yarn install
yarn install v0.23.2
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 📃  Building fresh packages...
✨  Done in 0.21s.

> ls node_modules 
leftpad

> cat yarn.lock
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


leftpad@^0.0.0:
  version "0.0.0"
  resolved "https://registry.yarnpkg.com/leftpad/-/leftpad-0.0.0.tgz#020c9ad0787216ba0f30d79d479b4b355d7d39c3"

What is the expected behavior?

In the above example, when node_modules is present but empty, leftpad should be installed to bring it up-to-date with the lockfile.

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

  • Node: 6.9.1
  • Yarn: 0.23.2
  • OS: OS X 10.11.6
@seansfkelley seansfkelley changed the title yarn install doesn't install is node_modules is present but in the wrong state yarn install doesn't install if node_modules is present but in the wrong state Apr 21, 2017
@torifat
Copy link
Member

torifat commented Apr 22, 2017

Currently this is the expected behavior. If you want to check every time you can run yarn install --check-files

@seansfkelley
Copy link
Author

I just found #2240 which appears to be a duplicate of this issue, so it looks like this is a point of confusion that has been around for quite some time.

@codebymikey
Copy link

@torifat awesome., is there a reason it's not promoted in the documentation?

@raido
Copy link
Contributor

raido commented May 15, 2017

@codebymikey yarnpkg/website#497

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

No branches or pull requests

4 participants