Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: added informative root directory install error #7596

Open
wants to merge 3 commits into
base: latest
Choose a base branch
from

Conversation

Sebastian-Webster
Copy link

What & Why

I've seen many instances of people getting this error Tracker "idealTree" already exists which is caused by installing packages in a root directory. Examples of where I've seen it:
Stack Overflow
docker/for-linux#1207
Reddit
lopau.com

In those examples, they all come from missing WORKDIR in the Dockerfile, but this error could also be caused by creating a new project in the root directory of an external drive in Windows.

Changes Made

With this PR, an error has been added when trying to run npm install or npm ci inside of a root directory. It will tell the person that they are running the command in a root directory and that root directory installs are not allowed. It also tells the person to create a new folder and install the packages in there to fix the issue.

@Sebastian-Webster Sebastian-Webster requested a review from a team as a code owner June 15, 2024 10:56
@wraithgar
Copy link
Member

This is a breaking change if we throw here. There are some instances where this will work, and those instances will no longer work if we accept this PR.

We either need to add this to the npm 11 roadmap, or change this to an error logging output, perhaps both.

@Sebastian-Webster
Copy link
Author

I was thinking of logging an error instead of throwing but I ended up going with throw to remove the operation not permitted error for Windows and the Tracker "idealTree" already exists error for macOS & Linux which may confuse some people.
The run on the top is with the throw and the one on the bottom is with the error log
Windows:
windows
macOS:
macos

We either need to add this to the npm 11 roadmap, or change this to an error logging output, perhaps both.

What would be the best route to take?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants