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.2k stars 867 forks source link

Add option to use system-provided node/npm/npx/yarn binaries #1089

Closed jirutka closed 1 year ago

jirutka commented 1 year ago

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

Feature.

What is the current behavior?

The plugin always runs node/npm/npx/yarn from a directory inside the project, even -Dskip.installnodenpm is used.

What is the expected behavior?

The plugin should provide an option to use system-provided node/npm/npx/yarn.

eirslett commented 1 year ago

I would suggest using exec-maven-plugin for this use case.

jirutka commented 10 months ago

This is not a solution. I’m not the author of an application using frontend-maven-plugin, I’m a packager who maintains a distribution package of an application using frontend-maven-plugin. And the build fails on aarch64 musl, because there’s apparently no prebuild nodejs for that architecture and libc:

[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.12.1:install-node-and-pnpm (default) on project keycloak-js-adapter-jar: Could not download Node.js: Got error code 404 from the server. -> [Help 1]

eirslett commented 10 months ago

I suppose Node/npm is just a build-time dependency and not a runtime dependency - could you run the frontend build on an x64 machine, and afterwards run the finished package on aarch64 musl?

jirutka commented 10 months ago

I suppose Node/npm is just a build-time dependency and not a runtime dependency

Yes.

could you run the frontend build on an x64 machine, and afterwards run the finished package on aarch64 musl?

No, this is an automated process in a Linux distribution (Alpine Linux).

The only thing I need is one switch that will force frontend-maven-plugin to run node and npm from PATH, as every normal program does, and not try to download some binary nor check version of the available node. I’m currently using a workaround – symlink system node and npm to ./node and override the node version parameter, but that’s clumsy and silly.