-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[BUG] npm install creates directories and empty package.json #7892
Comments
Agreed. Please fix. |
@brianpmaher I have tested the scenario where running npm install in an empty directory does not create a package.json or any other files, which seems to align with expected behavior npm generally needs a package.json to install dependencies. |
I misspoke, it creates a |
a similarly frustrating experience is if you desired behavior would be for npm to warn you that no |
this appears to be easily reproducible. Steps To Reproduce
A Expected BehaviorWhen a user runs step 3 |
I would be happy to author a PR on this, especially if someone is willing to point me in the right direction just to get started. |
@Kyle-Ignis Appreciate if you can raise the PR. |
…pty package.json file
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
Running
npm install
from a directory without a package.json creates a emptypackage.json
file.Additionally, running
npm --prefix some-directory install
will also create the directory.Expected Behavior
100% of the time I have done this, it has been on accident and I then have to go and delete the directory and/or the package.json file it creates.
I think it would be better to add an error message output indicating that there is no
package.json
present in the directory or the directory doesn't exist, and then suggesting I runnpm init
instead.Steps To Reproduce
mkdir temp
cd temp
npm --prefix temp2 install
Environment
The text was updated successfully, but these errors were encountered: