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.

There might be a problem with the project dependency tree.

See original GitHub issue

Hi!

The issue is simple

I have the same problem as in https://github.com/facebook/create-react-app/issues/5972

But I do not want to remove the other node_modules that lives higher up in the tree

Your docs and similar issues tells me to remove that node_modules, but it was made on purpose

I would like

  • either to run npm run build without error
  • or to understand why this is not feasible

Any stable work-arounds are welcome

Environment

Environment Info:

  System:
    OS: Linux 4.15 Ubuntu 16.04.6 LTS (Xenial Xerus)
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
  Binaries:
    Node: 12.4.0 - ~/.nvm/versions/node/v12.4.0/bin/node
    Yarn: 1.21.1 - /usr/bin/yarn
    npm: 6.13.4 - ~/.nvm/versions/node/v12.4.0/bin/npm
  Browsers:
    Chrome: 79.0.3945.88
    Firefox: 72.0.1
  npmPackages:
    react: ^16.10.2 => 16.10.2 
    react-dom: ^16.10.2 => 16.10.2 
    react-scripts: ^3.3.0 => 3.3.0 
  npmGlobalPackages:
    create-react-app: Not Found

Steps to reproduce

  1. npx create-react-app my-app
  2. npm init
  3. npm install webpack
  4. cd my-app
  5. npm run build

Expected behavior

npm run build builds the project, ignoring any node_modules living higher up in the tree.

That means, npm run build consider my-app as the root of the project and does not look in my home.

Actual behavior

A pre-flight check warning shows up. It assumes that the node_modules living higher up in the tree is accidental, which is not.

I do not want to skip preflight checks because:

  1. This is production content, I cannot take risks
  2. Seems like we cannot disable only that check

Capture du 2020-01-16 14-48-57

Reproducible demo

I believe the steps to reproduce, do reproduce the problem in every case.

If you really can’t reproduce, I will make a demo repo.

Thank you

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
heyimalexcommented, Jan 21, 2020

why a different version would cause bugs - CRA is not going to mix both right?

I need to think about this more, but I think that if it’s higher up in the tree it probably isn’t a problem. We could perhaps make the preflight check less restrictive here. Really not sure though!

why can’t we prevent npm or CRA to explore the whole filesystem

Just the nature of the beast. When you require something, node uses its resolution algorithm, and node’s resolution algorithm recursively checks the node_modules of parent directories.

if SKIP_PREFLIGHT_CHECK only skips that specific webpack check, or if it skips something else

It’s not really a webpack check, it’s just something we do to avoid mismatched versions. Setting SKIP_PREFLIGHT_CHECK=true will indeed just turn the check off.

0reactions
sguilliacommented, Feb 23, 2020

Thanks @heyimalex

Read more comments on GitHub >

github_iconTop Results From Across the Web

'npm start' returns error: "There might be a problem with the ...
There might be a problem with the project dependency tree. It is likely not a bug in Create React App, but something you...
Read more >
There might be a problem with the project ... - GitHub
To fix the dependency tree, try following the steps below in the exact order: Delete package-lock.json (not package.json!) and/or yarn.lock in your project...
Read more >
HOW DO I FIX THIS ERROR : r/reactjs - Reddit
There might be a problem with the project dependency tree. It is likely not a bug in Create React App, but something you...
Read more >
there might be a problem with the project ... - Code Grepper
There might be a problem with the project dependency tree. It is likely not a bug in Create React App, but something you...
Read more >
JS Bites: There might be a problem with the project ...
There might be a problem with the project dependency tree. It is likely not a bug in Create React App, but something you...
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