question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BUG: builder uses a package from the top level directory, not from its own.

See original GitHub issue

Describe the bug

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

Where

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

Steps to Reproduce

  1. cd .../sub-project
  2. Run script npm run start OR npm run build from /main-project/sub-project.
  3. Read error.

Current Behavior

It’s using package from folder /main-project Giving error:

There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.

The react-scripts package provided by Create React App requires a dependency:

  "webpack": "4.42.0"

Don't try to install it manually: your package manager does it automatically.
However, a different version of webpack was detected higher up in the tree:

  D:\WORK\Projects\main-project\node_modules\webpack (version: 4.43.0)

Expected Behavior

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

Did you try recovering your dependencies?

Yes. Package managers: npm, pnpm. Both didn’t work.

Which terms did you search for in User Guide?

npx create-react-app sub-project OR pnpx create-react-app sub-project

Environment

npx create-react-app --info

Environment Info:

  current version of create-react-app: 3.4.1
  running from C:\Users\work\AppData\Roaming\npm-cache\_npx\31100\node_modules\create-react-app

  System:
    OS: Windows 10 10.0.17763
    CPU: (8) x64 Intel(R) Core(TM) i7-4820K CPU @ 3.70GHz
  Binaries:
    Node: 14.0.0 - D:\Soft\nodejs\node.EXE
    Yarn: Not Found
    npm: 6.14.4 - D:\Soft\nodejs\npm.CMD
  Browsers:
    Edge: Not Found
    Internet Explorer: 11.0.17763.771
  npmPackages:
    react: ^16.13.1 => 16.13.1
    react-dom: ^16.13.1 => 16.13.1
    react-scripts: 3.4.1 => 3.4.1
  npmGlobalPackages:
    create-react-app: Not Found

Also: pnpm: 5.4.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
stale[bot]commented, Aug 22, 2020

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

0reactions
remorsescommented, Sep 25, 2020

Is this problem related to only pnpm?

Read more comments on GitHub >

github_iconTop Results From Across the Web

npm v7 does not install linked packages dependencies #2339
I believe that v6 puts all of the local install package's dependencies in its node_modules and not in the top level node_modules (hopefully ......
Read more >
build_runner 2.1.5 | Dart Package - Pub.dev
This package creates a top level .dart_tool folder in your package, which should not be submitted to your source control repository. You can...
Read more >
Non-standard files/directories, Rbuildignore and inst
In this post, we won't go into what these directories and files can contain and how they should be formatted, which is another...
Read more >
Chapter 6. Building the package - Debian
Although use of higher level commands such as gbp buildpackage and pbuilder ensures the perfect package building environment, it is essential to understand...
Read more >
Fedora Packaging Guidelines
The directory is wholly contained in your package, or involves core ... must not use the Fedora trademark, and instead roll their own...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found