1. 26


‘unisntall’ - https://github.com/npm/npm/issues/6095

‘verison’ - https://github.com/npm/npm/pull/6832


  2. 47

    When someone makes a typo there are 2 possible outcomes. Outcome 1: they are informed of their error and they can correct it or make an alias in their shell. Outcome 2: npm grows a new help option for every reported typo and eventually begins calculating the Levenshtein distance between the nearest valid option (an actual suggestion in the issue). Eventually typos make it into source code and scripts. Good luck grepping your codebase for usages of npm install.

    Introducing this “affordance” to the user results in a cascade of increased complexity. Furthermore it’s not “just” complexity in the toolset, but an increased cognitive load on the programmer. What’s next? I can only imagine how frightening using node would be if npm install package installed some other random package off the internet.

    Please keep “did you mean” functionality limited to search UIs.

    1. 13

      I guess if the user has such a problem with accidentally typing “npm isntall”, “npm unisntall” or “npm verison”, they should just create aliases in their own shell config instead of bloating the software.

      1. 3

        Good luck grepping your codebase for usages of npm install.

        This is easily fixed by making grep default to matching on small Levenshtein distances too! (Yes, this is sarcasm.)

        1. 2

          Well, it probably wouldn’t be so hard to extend regexes to compute a Levenshtein DFA during the compilation stage for fuzzy matching.

          [Is it bad that I’m wondering how hard it would be to implement, as a fun regex hack?]

      2. 29

        There’s a comment from Isaac himself in one of these threads:

        Removing isntall – or worse, replacing it with a Erm, so, I believe you meant “install”, perhaps if you invest in a typing tutor, preferably using a proper keyboard such as dvorak, you’d avoid such foolish errors type of message – is contrary to the spirit and voice of the npm client. It is a loving being who endeavors to be as helpful and friendly as possible. If it knows what you mean, it’ll just do what you wanted.

        This comment pretty perfectly describes the cheerfully clumsy attitude to software that I think npm wholly embodies. On the one hand, it purports to justify inconsistently elevating some misspellings of an actual command (why not other misspellings?). On the other hand it makes sure to take an emotionally loaded swipe at people that actually value precision in their software.

        Command line interfaces should validate their input and report failure when your input does not make sense. At present, it seems that NPM still simply ignores any random flags you pass to a command; whether a misspelling of --save, or something random like --blerg. Depending on the misspelling you may accidentally drop an argument that you really meant to specify – this is not friendly, it is just unsafe.

        1. 13

          I’m reminded of the anecdote in http://www.catb.org/jargon/html/D/DWIM.html. Automatic do-what-I-mean is dangerous! If you must implement it at all, git’s “did you mean” message is absolutely the furthest it should go (and since I suspect 99% of git commandline typos are obvious a la git lgo, the value of that feature is disproportionately below the amount of code written to implement it).

          1. 6

            Some one pointed out that it also spells out isn't all and just like that I’m thinking isntall could be a valid command that is not install. Not sure what isntall would do per se, but it could still be abstracted into something valid. I don’t like the idea of the codebase assuming I made a typo and going ahead with the command it thinks I want. I may have quick fingers but I’m not stupid.

            1. 23

              It drops npm into the existential-reflection shell, presumably.

              1. 7

                There’s a clickbait blog article waiting to be written titled npm isntall that

                1. 3

                  And then be all about the this keyword and never touch the isntall part.

                2. 3

                  Wait, I thought this was for checking the height of a dependency tree.

                3. 3

                  The real solution is having nice shell completions so people can tab their way to happiness.

                  1. 2

                    That escalated quickly.

                    1. 2

                      I am just glad it doesn’t search amazon for “isntall pkg” when you typo it.

                      1. 1

                        Isn’t all a package? :D

                      2. 2

                        Incoming: command line utils should ship with spell-checkers, because they don’t exist to punish people for their spelling mistakes. This is annoying me more than it should, since I use no node.js at all :)

                        1. 1

                          alias mpn=npm