yarnpkg/yarn

Yarn remove does not produce atomic results when missing --ignore-engines flag

Open

#2,934 opened on Mar 16, 2017

View on GitHub
 (1 comment) (3 reactions) (0 assignees)JavaScript (2,731 forks)batch import
good first issuehelp wantedtriaged

Repository metrics

Stars
 (41,514 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Yarn Version: 0.21.3 Node: v7.7.1 OS: OS X El Capitan 10.11.6

Current Behavior: Install a set of modules and passing "--ignore-engines" to allow version mismatches will install all modules and update the yarn.lock When removing any module (does not need to be the one with a version mismatch) if the "--ignore-engines" flag is not passed, the remove command will take the module out of node_modules but not remove it from yarn.lock, causing subsequent calls to remove to fail with "This module isn't specified in a manifest."

Steps to Reproduce:

$ yarn add module1 (a module that requires --ignore-engines) module2 --ignore-engines
# See yarn.lock and node_modules updated without problem
$ yarn remove module2
# See yarn.lock is not updated, but node_modules no longer has the module
# yarn remove v0.21.3
# error <redacted>: The engine "node" is incompatible with this module. Expected version "^4.5.0".
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/remove for documentation about this command.
# Use correct command
$ yarn remove module2 --ignore-engines
# # yarn remove v0.21.3
# [1/2] Removing module <redacted>...
# error This module isn't specified in a manifest.
# info Visit https://yarnpkg.com/en/docs/cli/remove for documentation about this command.

Expected Behavior:

If the first call to remove fails because of missing --ignore-engines, the package should not be removed from the manifest, everything should fail, so on subsequent calls, the corrected "--ignore-engines" request can succeed.

Some items <redacted> because of company modules / packages

Contributor guide