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

[BUG] npx --force warning hides confirmation prompt to install package #3461

Closed
bmwalters opened this issue Jun 23, 2021 · 5 comments
Closed
Labels
Bug thing that needs fixing Good First Issue good issue or PR for newcomers Priority 2 secondary priority issue Release 7.x work is associated with a specific npm 7 release

Comments

@bmwalters
Copy link

bmwalters commented Jun 23, 2021

Current Behavior

When using npx --force, the warning printed due to using --force covers up the prompt asking the user to enter "y" to proceed. At first glance it looks like the command has hung waiting for I/O or something.

$ npx --force mkdirp
npm WARN using --force Recommended protections disabled.
Need to install the following packages:
  mkdirp
⸨░░░░░░░░░░░░░░░░░░⸩ ⠙ : WARN using --force Recommended protections disabled.

Expected Behavior

The command output should not hide the line prompting the user to enter "y" to proceed.

Steps To Reproduce

  1. Use a system without any packages installed globally / in the cache.
  2. npx --force mkdirp.
  3. Observe the command output.

Environment

  • OS: macOS 11.3.1
  • Node: 16.3.0
  • npm: 7.15.1
  • shell: fish 3.2.2
@bmwalters bmwalters added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Jun 23, 2021
@wraithgar wraithgar added Priority 2 secondary priority issue and removed Needs Triage needs review for next steps labels Jun 25, 2021
@wraithgar
Copy link
Member

This does not attempt to pause the log, if log.clearProgress() is available:

https://github.com/npm/libnpmexec/blob/main/lib/index.js#L168-L171

@wraithgar wraithgar added the Good First Issue good issue or PR for newcomers label Jun 25, 2021
@lauta3011
Copy link

This also happens when trying npm cache clean --force

@rayw000
Copy link

rayw000 commented Aug 3, 2021

I've post PR npm/libnpmexec#8 to fix this issue.

@lauta3011 npm cache clean --force works for me as it is supposed, and also npm cache clean. Could you provide more details about what happened to you?

@wraithgar
Copy link
Member

With new libnpmexec:

~/D/n/cli (release-next↑1|✔) $ node . exec @gar/create-test --force
npm WARN using --force Recommended protections disabled.
Need to install the following packages:
  @gar/create-test
Ok to proceed? (y) 

@wraithgar
Copy link
Member

Thank you @rayw000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Good First Issue good issue or PR for newcomers Priority 2 secondary priority issue Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants