yarnpkg/yarn

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

Open

#2,934 创建于 2017年3月16日

在 GitHub 查看
 (1 评论) (3 反应) (0 负责人)JavaScript (41,514 star) (2,731 fork)batch import
good first issuehelp wantedtriaged

描述

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

贡献者指南

Yarn remove does not produce atomic results when missing --ignore-engines flag · yarnpkg/yarn#2934 | Good First Issue