Open vincentol opened 5 months ago
Is there a reason you absolutely need npx? The "normal" approach is to add scripts to package.json
and run those from Maven?
We have a private package uploaded to our google artifact registry, we run a command with npx
to authenticate into it:
https://cloud.google.com/artifact-registry/docs/nodejs/authentication#get-token
We actually do have a script in our package.json, but it just calls that npx command (we got it from the artifact registry docs). When I did some digging, I discovered that it was failing because we couldn't run any npx
commands from Maven
Similar issue here, I want to build my app and then apply some rollup configuration so I use the following package.json script: "build:single": "ng build --output-hashing=none --named-chunks=true && npx rollup -c rollup.config.mjs",
Which is failing with:
[INFO] sh: 1: npx: not found
[INFO] ELIFECYCLE Command failed.
I'm facing the same issue while running sonarqube-scanner with npx. I upgraded a project from npm 8.5.x to a recent 10.x version which broke the scanner execution with the ENOENT error. There is a folder called 'node' in target/frontend-binaries which contains npm and npx binaries, but there is no 'lib' folder next to it.
I went looking for the exact npm version for which it breaks, which turns out to be 8.16.0. Anything lower than that is working just fine for me. I'm using Linux, Java 17, Maven 3.9.6.
You shouldn't really need npx
as long as the command is defined inside package.json
. Just remove it. Try this:
"scripts": {
"build:single": "ng build --output-hashing=none --named-chunks=true && rollup -c rollup.config.mjs"
}
@eirslett I tried adding a script entry for it, but it doesn't find the sonar-scanner this way, command not found. I also tried installing it globally before calling it which did not help either. Next I tried a shell script, same issue.
What did the script entry look like? There's no sonar-scanner in the current example...
Hi! Same issue here. Regarding the logs we see the copy of node binary but not the embedded toolchain.
Why npx
? Because it can act like a script but using packages not requiring specific configuration without extra dependency management.
In our case we would like to use npx
for checking optimized dependencies information in the yarn.lock file after dependency upgrades. The idea is to run the next command before the yarn install
goal:
npx yarn-deduplicate yarn.lock --list --fail
This will prevent installation of unwanted duplicated modules that may issue unexpected behavior during build, test, lint goals.
In other hand it would be great to be able to use the full node toolchain for such use cases.
Do you want to request a feature or report a bug?
Bug
I can't run
npx
commands unless I explicitly add a step to installnpx
globally. 🙏 Hoping I'm just misconfiguring something somewhere because the docs and other issues seem to have this working. The end goal is to have thisnpx
command running in apreinstall
script, which should have been fixed in: https://github.com/eirslett/frontend-maven-plugin/issues/1002What is the current behavior? Any
npx
command I try is failingIf the current behavior is a bug, please provide the steps to reproduce.
What is the expected behavior? Should be able to run
npx
commands -> as mentioned in the readmePlease mention your frontend-maven-plugin and operating system version. frontend-maven-plugin: 1.15.0 OS: MacOS 14.1.2 (Sonoma)