v3.2: Turn ENOENT missing package.json warnings and errors off? #9161
Comments
|
When I want to test people's repro cases for bugs (which I do many many times a week), this is what I do: This silences the warnings and also gives me something to refer to later when I'm trying to remember what I was doing. If you want to turn off warnings altogether, you can run |
As suggested in npm/npm#9161.
|
I am getting this in response to This is at least confusing and unnecessary. Kind of violates principle of least astonishment. And it is not a reason (not even contributing to) the ultimate failure (which is sass/node-sass#1061) |
|
@othiym23: the real issue here is why are those warnings displayed? What made npm try to consult I believe this ticket was closed too quickly. |
|
|
|
We're in the business of computers doing what they are told, not what the operators actually want. Installing packages in unexpected places is one of the possible outcomes. I can see the intention, but over time, any operator will ignore them as noise. That's why they should be conditioned by actual need of |
|
So go ahead and disable the possibilty to run |
|
Agree ^ |
|
to start using NPM you need to initialize it for project you are developing, br, Q |
|
Note that this warning also happens when installing packages outside any modules with a non-root user (at least on OSX). At the very least, this behavior seems pretty uninformative, and the above is not an unreasonable use case (as far as I can tell) for installing node-based CLI tools that are distributed by NPM as a non-root user. |
|
Fresh install on OSX 10.11.6 with node.js 6.4.0 Current: |
|
Please reopen this issue and eliminate these unjustified and annoying warnings. |
|
for remove these warnings from CLI when instaling it on magento local root then just check 2 files - |
|
i also get the same error but i am not able to remove it. give me any solution by which i can solve it |
|
check your magento root directory and find these 2 files : |
|
magento is not in my aptop |
|
this is the error msg npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Astha Gaur\package.json' |
|
solution to some use cases (not OP) : replace |
|
thanks Qkenkenu! |
|
i am using window On Fri, Sep 23, 2016 at 5:53 PM, pannous notifications@github.com wrote:
|
|
I got this message while installing the newman and after that I'm checking the newman command it says 'newman' is not recognized as an internal or external command, npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\SUNKPOLP18\package.json' |
|
fristly run npm init command then it will ask some question , you have give ask to all these . On Thu, Sep 29, 2016 at 3:42 PM, RamMohan notifications@github.com wrote:
|
|
This Works! |
|
@TejashreeD this does work! thx a lot! |
|
My comment has seen so many votes, yet nobody from npm cares. And it's not the only comment that received public approval. @othiym23, is it so difficult to admit that your way of thinking is not popular (to say the least) and fix this nonsense? Are you waiting for it to get even older than it already is (more than one year 👎 ) and then claim that "it's been working like this since forever"? |
|
@acarstoiu please be more respectful. Also, the CLI team has a lot of work todo, as noted by the 2400+ open issues. Please be patient. |
|
@acarstoiu, |
Node.js works without |
|
@legodude17 it is entirely reasonable to want to install one of the many CLI packages for node. Doing |
|
@psigen Fortunately that's exactly the behavior you'd see today when globally installing packages. |
|
As @othiym23 said, you can just use On Sat, Nov 19, 2016 at 11:35 AM, Eugene Sharygin notifications@github.com
|
|
For your information, Node.js works very well without any So, once again, a missing |
|
@acarstoiu I don't understand why you are so devoted to removing the warnings, when you could talk like a second to run |
|
I got here because of similar error messages but discovered it was because my editor had replaced all the spaces with tabs in package.json - so watch your package.json format! |
|
NPM professionalism... |
|
@legodude17 It feels like a hack to init a package when you are not in fact creating a package just to install other packages and suppress warnings? I just got bit by this in our build process, and it took me 20 minutes to track down. I'm happy to use the work around but I think @acarstoiu has a valid point even if the delivery of the message could have been better. Would we benefit from a cli switch to suppress warnings? I personally rather see this thrown as INFO before the package install starts versus doing the right thing then throwing a warning. |
|
As said, there are a lot of use cases where you are not creating a package. I'm writing a demonstration in which I have to use an NPM installable tool. Having a warning printed in a demonstration is very inconvenient, because you don't want to waste time explaining why it is there (which I frankly don't understand) and you also don't want to confuse your audience with workarounds. |
|
Chiming in alongside everyone else. I've just installed node and haven't started any projects yet. I do |
|
+1 This is pretty annoying and unuseful error reporting. It would be cool if npm errors had hints to resolve the warning generated. |
|
@sparr What is the use case for putting packages in your home directory? I have done that multiple times, every time it was a mistake, hence the warning. @tcsiwula that would be a different issue. |
|
@legodude17 use case: I am not a Node module developer. I am just writing a five line node script without its own directory or npm init'd environment, and I need to install a dependency for it. This is the equivalent of |
|
If you think that is the best way, ok. IMHO it would be better to make that five line script into a module/package. |
|
@legodude17 YHO about what approach is better isn't relevant to the thousands of people who won't ever get involved with the node/npm community standards regarding module development, and just want to write a script and run it like they can in any other language |
|
Personally, my five line script is now 200 lines long, and I have done |
|
+1 For these warnings being unhelpful and confusing |
|
I got this error when trying to install jquery. I've never used Node.js before. Coming at this from the newbie's perspective, this is a noob-unfriendly warning. I'm trying to diagnose a problem and made the [quite natural] assumption that this might be the cause. It's the opposite of intuitive, and serves as a very efficient way of frustrating beginners away from pursuing work with Node. If the existence of package.json is so "strongly preferred," why not at least make the warning more informative? "Package.json is not required but is strongly preferred. Use [command] to create one for your project." ...so that we don't have to do google searches, then hopefully find this thread and have to read through several of its posts before finding the full explanation...? |
|
npm install -g --save [package_name] This worked! |
|
I got this error after I removed two unused packages (bower and grunt) with Sure the package.json files don't exists. But who requested them?? Neither of the following tips had an effect:
Finally I resolved this warning by deleting the whole node_modules folder and run This warnings are useless if you don't know where they came from! |
|
Even I got same problem... |
|
There is one simple solution to this issue. Make sure that you are inside your project's directory when you run |
|
Didn't work for me, see #9161 (comment) |
|
@shivamgupta-gupta you may have missed it up-thread, but many of us are not working in a node project directory. |
|
@sparr I haven't worked on complex projects but did you try this in your root directory? |
|
@shivamgupta-gupta Sorry if I was unclear. Some of us are not working on a thing that is a node project at all. |
|
Voting to close the issue...@mhamzas From a StackOverflow answer:
|
Is there going to be a config option to silence warnings and errors telling me that I miss
package.json(when in reality this is intentional)?I often install stuff to temporary directories just to play/experiment and I'm not comfortable seeing these errors all the time.
Or even:
The text was updated successfully, but these errors were encountered: