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

CLI v5.1.x commands may block due to npm installation prompt #469

Open
cmf-moreira opened this issue Jan 24, 2025 · 0 comments
Open

CLI v5.1.x commands may block due to npm installation prompt #469

cmf-moreira opened this issue Jan 24, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@cmf-moreira
Copy link
Contributor

Description

There may be commands of the @criticalmanufcturing/cli that may block, stating that an NPM package needs to be installed, but nothing then happens.

This usually occurs when an npx command is called and the package is not in the cache. In that case, the npx command prompts if the user authorizes the installation, but as the CLI standard input is not linked to the command input, the application stays blocked.

To ensure this is in fact the case, run the @criticalmanufacturing/cli command with debug active:

cmf -l Debug <command_args>

Then, check on standard output that in fact npx command is being called and that it is requesting a package to be installed and that the command is then blocked.

Steps to reproduce the issue

  1. Clear your npx cache, by deleting the corresponding directory:

     npx --yes clear-npx-cache
  2. Init a new MES customization project, using cmf init command.

  3. Create a new UI/HTML package layer, using cmf -l Debug new html

  4. You will see that your console will be blocked on first attempt to run an npx @angular/cli command.

Workaround

To work around the issue in this situation, while a fix is not ready, you should run the npx command with the --yes option to install the package with no prompt:

npx --yes @package_to_install[@version]

Then re-run the cmf command. It should then be able to proceed, when previously it was blocked.

Possible fixes

Below are some possible solutions to fix this issue:

  1. Add the --yes flag to npx commands to force the installation of the packages without prompting the user. We need to ensure it does not affect @criticalmanufacturing/cli behaviour if NPM v10 prior versions are in use.
  2. Redirect console.input to npx commands so the user can accept the package installation and unblock npx execution.
@cmf-moreira cmf-moreira added the bug Something isn't working label Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant