cli icon indicating copy to clipboard operation
cli copied to clipboard

[BUG] npm 10.6.0 doesn't log anything while npm install

Open lorand-horvath opened this issue 1 year ago • 5 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

This issue exists in the latest npm version

  • [X] I am using the latest npm

Current Behavior

The latest npm 10.6.0 doesn't log anything while installing the packages with npm install. It only prints the final results. So npm is working for almost 50 seconds without notifying the user whether it is doing anything at all. The behavior is similar to npm install --loglevel silent of the previous version 10.5.2.

Expected Behavior

The logging should be displayed, showing the user that the installation is proceeding. It shouldn't be silenced completely.

Steps To Reproduce

  1. Environment: Command Prompt, npm 10.6.0, node 18.20.2
  2. npm install with an existing package.json in the root directory
  3. no loggin observed while installing the packages to node_modules

Environment

  • npm: 10.6.0
  • Node.js: 18.20.2
  • OS Name: Windows
  • System Model Name: Desktop PC
; copy and paste output from `npm config ls` here

lorand-horvath avatar Apr 26 '24 09:04 lorand-horvath

The progress bar in npm has been temporarily removed. It was conflicting with logging output and was generally inaccessible. What you are used to seeing is a mix of the progress bar and verbose logging (which was shown erroneously, regardless of loglevel). If you want to see the logging messages you can use --verbose.

wraithgar avatar Apr 26 '24 13:04 wraithgar

@wraithgar I would prefer seeing some kind of progress log while npm is actually performing some work, by default. Otherwise users might confuse the silence with the process being stalled or hanging or a bug or something. Sometimes an npm install on a large project may take several minutes. Something should be displayed (some sort of spinner, progress bar, etc) while doing work that take longer than, say, 5 seconds. Is this total silence a temporary problem? Are you going to add back some kind of progress bar in later version?

I had to revert to 10.5.2 because this was very strange, not showing anything for long periods of time - I thought something was broken.

lorand-horvath avatar Apr 26 '24 14:04 lorand-horvath

Yes it is temporary.

wraithgar avatar Apr 26 '24 14:04 wraithgar

I thought something was broken

Same here, so I interrupted my npm update -gs command and then something actually was broken. As in my entire NPM install. I had to note down my global packages by looking at the contents of the install directory, then uninstall and reinstall node with NVM and install all of my stuff again.

Not a huge disaster, but definitely not great either.

So word to the wise: don't interrupt it when you have the -g flag, because you will probably break your NPM 😓

henderea avatar Apr 26 '24 15:04 henderea

We'll keep this open until we land a new "npm is actually doing something" visual. It probably won't be a progress bar initially but a simple spinner.

lukekarrys avatar Apr 26 '24 16:04 lukekarrys

@lukekarrys @wraithgar Thanks for taking the time to add the spinner! However, this could be improved upon, compared to how it was before in 10.5.2. My concerns are the following:

  1. The spinner is there as expected, but there's a constant blinking cursor overlapping with it and it looks a bit unfinished or buggy.
  2. The installation process seems slower. I could revert to 10.5.2 and time the installations to see what the difference is.
  3. The spinner is not enough as default information. In previous versions I really liked the way it informed the user about what was currently doing, for example during npm install, so I would very much like to see something of the sort:
\ install [email protected]
| install [email protected]
/ install [email protected]
- update [email protected]
\ update [email protected]
| reify etc...

Wouldn't that be nicer?

lorand-horvath avatar May 01 '24 08:05 lorand-horvath

Those are good suggestions. To take them point by point:

  1. There is a way to hide the cursor which should be easy enough to do only when the spinner is visible. I will look into this and any accessibility implications it might have.
  2. I'd be interested in seeing benchmarks if you have any from before and now. Also if you run with --no-progress do you still see a performance impact?
  3. The reason we moved away from how it used to work is that the progress bar showed messages that were primarily intended for logging. They weren't tailored for usability and would often show the last completed action when the current running action was hanging which led to lots of confusion. I'm in favor of bringing something similar back but we'd first need to put all the events in place in Arborist to accurately indicate what's happening in a user-friendly manner. But that will take more time.

Im going to log these in our follow up status board issue. Thanks for taking the time to provide these feedback!

lukekarrys avatar May 01 '24 16:05 lukekarrys

You can get what you described by setting your log level to http, those were the logging messages "leaking" into the progress bar before.

wraithgar avatar May 01 '24 16:05 wraithgar

@wraithgar I've tried npm install --loglevel http and I get a long running list with the package downloads (http fetch), which is not bad per se, but I'd like to see what is actually being installed and also other activities being performed, not only what is being downloaded (or found in cache); all of this preferably in one single progress line (the previous action needs to be overwritten to the same line), similar to how it was before in 10.5.2.

lorand-horvath avatar May 01 '24 18:05 lorand-horvath

2. I'd be interested in seeing benchmarks if you have any from before and now. Also if you run with `--no-progress` do you still see a performance impact?

I've run several benchmarks on a certain package (react frontend app) and the difference is not so large: npm 10.5.2: npm install finished in 1:10 npm 10.7.0: npm install finished in 1:07 npm 10.7.0: npm install --no-progress finished in 0:59

3. The reason we moved away from how it used to work is that the progress bar showed messages that were primarily intended for logging. They weren't tailored for usability and would often show the last completed action when the current running action was hanging which led to lots of confusion. I'm in favor of bringing something similar back but we'd first need to put all the events in place in Arborist to accurately indicate what's happening in a user-friendly manner. But that will take more time.

I'd very much like to see a user-friendly manner of displaying the currently performed action with npm install, I posted more details in my comment above to @wraithgar

Im going to log these in our follow up status board issue. Thanks for taking the time to provide these feedback!

Thank you @lukekarrys @wraithgar for your quick and constructive responses!

lorand-horvath avatar May 01 '24 18:05 lorand-horvath

you should at least warn users who don't usually read docs or issues about the removal of something as iconic and important as a progress indication, why not at least copy what pnpm has achieved, which is a very clean and informative enough approach? a spinner is like a joke

voltuer avatar Jun 05 '24 13:06 voltuer

One thing to add is that nothing shows when you use the -s flag. It used to show the progress stuff in older versions, just without all of the extra lines of output, so I think the spinner should show even with the -s flag. Because leaving off the -s flag means a lot of extra output that I generally don't want to see.

henderea avatar Jun 10 '24 15:06 henderea

This update also coincides with this spinner getting stuck at times giving no info at all where. I thought npm is broken glad to see it was just a bad decision.

DanielSharp01 avatar Jul 30 '24 00:07 DanielSharp01