verifyPackageTree() errors when wrong version dependency is installed in any parent directory
Created by: newoga
Is this a bug report?
Yes
Did you try recovering your dependencies?
No. This issue presents an argument that there may be a bug in the verifyPackageTree.js logic added in the next
branch.
Which terms did you search for in User Guide?
version
, dependenc
. This does not appear to be documented (and since it is internal, maybe it shouldn't be). There is discussion regarding documenting some of the packages related to this in issue in issue #4137 (closed) (suggested by @Timer here).
Environment
$ node -v
v8.9.4
$ npm -v
5.7.1
$ yarn --version
1.5.1
Running on macOS 10.13.2
.
Steps to Reproduce
I created a reproduction project here: https://github.com/newoga/create-react-app-issue-4167
The project is a simple node package that depends on a version of jest
that is incompatible with create-react-app@2.0.0-next.47d2d941
. The project also contains a directory (cra-app
) that was generated by create-react-app
. The react-scripts
dependency in that sub-project has been updated to 2.0.0-next.47d2d941
.
git clone https://github.com/newoga/create-react-app-issue-4167
cd create-react-app-issue-4167
yarn
yarn run
Expected Behavior
From a user perspective, the yarn run
command should not error and the application should start. The user did not manually install an incompatible version of jest
in the create-react-app
generated project. The version of jest
in the generated project's node_modules
is the correct version and parent directories should not have an impact.
From a technical perspective, the verifyPackageTree.js
logic should see that the cra-app
project contains the correctly installed version of jest
and stop checking parent directories. Parent directories should only be traversed if jest
is not installed.
Actual Behavior
An error occurs because parent directory depends on a version of jest
that is incompatible with the version of jest
that create-react-app
generated project depends on.
Reproducible Demo
https://github.com/newoga/create-react-app-issue-4167
Edit: Updated the issue number on the links.