srs / gradle-node-plugin

Gradle plugin for integrating NodeJS in your build. :rocket:
Apache License 2.0
867 stars 210 forks source link

npm install on alpine is wrong #357

Open kappelmi opened 4 years ago

kappelmi commented 4 years ago

Hi i am using this plugin on 2 instances of linux. I have seen following error on 1 of the instance newly added to the system:

Task ':OlisWebGUI:npm_install' is not up-to-date because: Task has not declared any outputs despite executing actions. Starting process 'command '/home/jenkins/slave/workspace/test/workspace/OlisWeb/OlisWebGUI/.gradle/nodejs/node-v12.13.1-linux-x64/bin/npm''. Working directory: /home/jenkins/slave/workspace/test/workspace/OlisWeb/OlisWebGUI Command: /home/jenkins/slave/workspace/test/workspace/OlisWeb/OlisWebGUI/.gradle/nodejs/node-v12.13.1-linux-x64/bin/npm install Successfully started process 'command '/home/jenkins/slave/workspace/test/workspace/OlisWeb/OlisWebGUI/.gradle/nodejs/node-v12.13.1-linux-x64/bin/npm'' env: can't execute 'node': No such file or directory :OlisWebGUI:npm_install (Thread[Execution worker for ':' Thread 5,5,main]) completed. Took 0.066 secs.

FAILURE: Build failed with an exception.

after long debugging, i have found out, the linux i am using where this is failing is alpine, and it looks like, node original distro requires libc, but alpine uses musl

analyzing the official docker image from node:alpine it looks like, there is an unofficial distro for alpine linux.

would it be possible to fix the plugin, so it would detect alpine linux and download the proper distro from node/npm ?

Thanks, kappelmi

kappelmi commented 4 years ago

pls also have a look in this file: https://github.com/nodejs/docker-node/blob/c6bc44e84afcdb81d9749b7b034c60e916a519ad/10/alpine3.10/Dockerfile

magro commented 4 years ago

@kappelmi I'm experiencing the same issue on alpine, have you found a solution for this?

deepy commented 4 years ago

It's because alpine uses musl and there's no official nodejs for musl. There's some more info in the fork at https://github.com/node-gradle/gradle-node-plugin/issues/51