eirslett / frontend-maven-plugin

"Maven-node-grunt-gulp-npm-node-plugin to end all maven-node-grunt-gulp-npm-plugins." A Maven plugin that downloads/installs Node and NPM locally, runs NPM install, Grunt, Gulp and/or Karma.
Apache License 2.0
4.22k stars 868 forks source link

Npx goal adds --registry as an argument of the executable command #1005

Closed rsynek closed 2 years ago

rsynek commented 2 years ago

Do you want to request a feature or report a bug? Bug

What is the current behavior? The plugin adds --registry as an argument of the command npx is supposed to execute. The build fails as the command does not recognize the --registry option.

If the current behavior is a bug, please provide the steps to reproduce.

  1. configure an execution with npx, e.g.:
    <execution>
            <id>run antora</id>
            <goals>
              <goal>npx</goal>
            </goals>
            <phase>generate-resources</phase>
            <configuration>
              <arguments>antora</arguments>
            </configuration>
    </execution>
  2. run mvn generate-resources -DnpmRegistryURL=https://some.repository.org
  3. the build fails due to error: unknown option '--registry=https://some.repository.org' as antora does not recognize the --registry option.

What is the expected behavior? The plugin should prepend the npx arguments before the command, see https://docs.npmjs.com/cli/v7/commands/npx#npx-vs-npm-exec. However, the --registry option does not seem to be supported by npx anyway.

Please mention your frontend-maven-plugin and operating system version. 1.12.0 Ubuntu 20.04.3 LTS

Daolot commented 2 years ago

Faced a similar problem while working with yarn run

Daolot commented 2 years ago

Looks like yarn use npm registry property... https://github.com/eirslett/frontend-maven-plugin/blob/master/frontend-maven-plugin/src/main/java/com/github/eirslett/maven/plugins/frontend/mojo/YarnMojo.java

Daolot commented 2 years ago

@rsynek Looks like there is WA: 1) pom file: `

build:prod

`

2) package.json file: "scripts": { "build:prod": "{ng build --configuration production}" },

magic in {ng build --configuration production} instead ng build --configuration production

rsynek commented 2 years ago

Bugfix is coming in this PR: https://github.com/eirslett/frontend-maven-plugin/pull/1013

rsynek commented 2 years ago

https://github.com/eirslett/frontend-maven-plugin/pull/1013 merged; closing this issue.