npm / cli

the package manager for JavaScript
https://docs.npmjs.com/cli/
Other
8.44k stars 3.14k forks source link

BUG: npm uses a package from the top level directory, not from its own. #1537

Closed akopchinskiy closed 3 years ago

akopchinskiy commented 4 years ago

What / Why

npm for some reason, it uses a package from the top level directory, not from its own. Ambiguous behavior, seems like a bug.

When

/main-project
├─── /node_nodules
├─── /webpack@4
├─── package.json
└─── /sub-project
│      ├── /node_nodules
│      ├── /webpack@3
│      └── package.json

Where

How

Steps to Reproduce

cd .../sub-project Run script react-scripts from here (/sub-project). Read error.

Current Behavior

It's using package from folder /main-project Giving error: You have installed webpack@3 in /main-project

Expected Behavior

It's using package from /sub-project. No errors, obviously.

darcyclarke commented 3 years ago

npm v6 is no longer in active development; We will continue to push security releases to v6 at our team's discretion as-per our Support Policy.

If your bug is preproducible on v7, please re-file this issue using our new issue template.

If your issue was a feature request, please consider opening a new RRFC or RFC. If your issue was a question or other idea that was not CLI-specific, consider opening a discussion on our feedback repo

Closing: This is an automated message.