Skip to content

Change default value of the preferLocal option to false#314

Merged
sindresorhus merged 1 commit intomasterfrom
feature/change-preferlocal-default
Jun 24, 2019
Merged

Change default value of the preferLocal option to false#314
sindresorhus merged 1 commit intomasterfrom
feature/change-preferlocal-default

Conversation

@ehmicky
Copy link
Copy Markdown
Collaborator

@ehmicky ehmicky commented Jun 24, 2019

This changes the default value of the preferLocal option to false.

This option causes several issues for some users: #196, #153.

@ehmicky
Copy link
Copy Markdown
Collaborator Author

ehmicky commented Jun 24, 2019

CI tests are working now.

@sindresorhus
Copy link
Copy Markdown
Owner

For posterity, here's my reasoning for doing this change:

  • Most cases don't actually spawn local binaries from node_modules.
    I realized that most of the cases are global binaries and local ones with {cwd: __dirname}.
  • The few times you actually need it, it might be more readable to make it explicit.
  • It causes surprising behavior then because:
    1. Yarn mocks with the PATH too.
    2. Some Node.js installation has a node_modules directory or npm directory that will be used instead of what the user actually wanted. This can happen silently and cause confusion.

So basically, I think we should default to the least surprising behavior.

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

Successfully merging this pull request may close these issues.

2 participants