yarnpkg/yarn

Possibility to add warning when running yarn in directory containing node_modules but missing yarn.lock

Open

#3373 opened on May 10, 2017

View on GitHub
 (8 comments) (0 reactions) (0 assignees)JavaScript (41,514 stars) (2,731 forks)batch import
cat-featuregood first issuetriaged

Description

Would it be possible to add some kind of warning when running yarn inside directory where node_modules already exist, but there is no yarn.lock file?

The only use-case for this should be when migrating from npm to yarn. I realized yarn updated all my node_modules only after I ran yarn command and then it was too late to search for yarn import.

It would be nice to get warning, that running yarn or yarn install without yarn.lock will result in node_modules being downloaded and updated.

I realize this experience is depending on environment, but the destructive nature of such simple mistake could warrant some kind of protection against it.

Alternatively, running yarn command in this specific case, could by default fallback to yarn import command instead of yarn install.

Also yarn import command could be mentioned on https://yarnpkg.com/lang/en/docs/migrating-from-npm/ page.

Contributor guide