frontend-maven-plugin icon indicating copy to clipboard operation
frontend-maven-plugin copied to clipboard

Incorrect download path for nodejs

Open skwokie opened this issue 5 years ago • 14 comments

Do you want to request a feature or report a bug? I believe it is a bug. Please educate me if it is something else.

What is the current behavior? While compiling the Graylog server project (https://github.com/Graylog2/graylog2-server) that uses this plugin, it failed with:

Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.8.0:install-node-and-yarn (install node and yarn) on project graylog2-server: Could not download Node.js: Got error code 404 from the server. -> [Help 1]

and the reason is that it tries to download https://nodejs.org/dist/v12.13.1/node-v12.13.1-linux-x86.tar.gz and I'm afraid it doesn't exist.

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

git clone https://github.com/Graylog2/graylog2-server.git
cd graylog2-server/
mvn clean install

What is the expected behavior? Successfully download the dependency and install it.

Please mention your frontend-maven-plugin and operating system version. In the parent pom:

        <!-- Nodejs dependencies -->
        <nodejs.version>v12.13.1</nodejs.version>
        <yarn.version>v1.19.2</yarn.version>
...
                <plugin>
                    <groupId>com.github.eirslett</groupId>
                    <artifactId>frontend-maven-plugin</artifactId>
                    <version>1.8.0</version>
                </plugin>

In the child pom

                    <plugin>
                        <groupId>com.github.eirslett</groupId>
                        <artifactId>frontend-maven-plugin</artifactId>

                        <executions>
                            <execution>
                                <id>install node and yarn</id>
                                <goals>
                                    <goal>install-node-and-yarn</goal>
                                </goals>
                                <configuration>
                                    <nodeVersion>${nodejs.version}</nodeVersion>
                                    <yarnVersion>${yarn.version}</yarnVersion>
                                </configuration>
                            </execution>

                            <execution>
                                <id>yarn install</id>
                                <goals>
                                    <goal>yarn</goal>
                                </goals>
                                <!-- Optional configuration which provides for running any npm command -->
                                <configuration>
                                    <arguments>install</arguments>
                                </configuration>
                            </execution>

                            <execution>
                                <id>yarn run build</id>
                                <goals>
                                    <goal>yarn</goal>
                                </goals>
                                <configuration>
                                    <arguments>run build</arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

It is a box on AWS running Ubuntu.

ubuntu@ip-10-0-8-52:~$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.4 LTS
Release:	16.04
Codename:	xenial
ubuntu@ip-10-0-8-52:~$

Thanks!

skwokie avatar Mar 06 '20 05:03 skwokie

facing the same issue on windows 10 x64 architecture

forkserver avatar May 12 '20 16:05 forkserver

The same in Ubuntu 20.20

saitohfin avatar Sep 29 '20 12:09 saitohfin

What do the logs say? If there is x86 in the URL, it detects your system as 32-bit, even though it's 64 bit. What is os.arch set to in Java? The logic in this plugin is in the file Platform.java.

eirslett avatar Sep 29 '20 13:09 eirslett

Sorry, I haven't now the logs.

But told "Could not download Node.js": Got error code 404 from the server. And I could see how it was trying to take this file node-14.2.0-linux-x86.tar.gz which does not exists.

Yes seems he thinks my system is 32bits, this is my system: Linux e2y-es-08 5.4.0-48-generic #52-Ubuntu SMP Thu Sep 10 10:58:49 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

My arch returns "i386"

saitohfin avatar Sep 29 '20 13:09 saitohfin

i386 is from 1985 and is definitely a 32-bit processor. If your JDK determines i386 as arch, then it sounds like something is wrong with your JDK... did you install a 32-bit JDK?

eirslett avatar Oct 07 '20 00:10 eirslett

I updated the jdk and seems that, now I take a amd64. In any case, for the people who is using a 32bits version won't find that

saitohfin avatar Nov 03 '20 16:11 saitohfin

I use 32bit Arch Linux on raspberry pi 4 armv7l.

bash-5.0# uname -a
Linux piaz4 5.4.75-1-ARCH #1 SMP PREEMPT Mon Nov 9 16:58:39 UTC 2020 armv7l GNU/Linux

The architecture detection code obviously doesn't work right. It would be useful to be able to force the architecture manually in the configuration.

INFO] Downloading https://nodejs.org/dist/v12.16.1/node-v12.16.1-linux-x86.tar.gz to /root/.m2/repository/com/github/eirslett/node/12.16.1/node-12.16.1-linux-x86.tar.gz
...
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.10.0:install-node-and-npm (install node and npm) on project folio: Could not download Node.js: Got error code 404 from the server. -> [Help 1]

In this case, the file https://nodejs.org/dist/v12.16.1/node-v12.16.1-linux-armv7l.tar.gz would be the right choise

bornf avatar Nov 12 '20 09:11 bornf

Yup, the architecture was initially only implemented to support Linux, MacOS and Windows, the most common operating systems that developers use. I don't own a raspberry pi, so it's hard to implement support for it.

If you can fix the architecture detection and send a PR, I would be open to merging it.

eirslett avatar Nov 12 '20 12:11 eirslett

I have the same problem with a MacBook Pro with Apple Silicon, the arch is arm but I want to download the x64 version Can you add a prop to force the platform?

Teg79 avatar Mar 15 '21 12:03 Teg79

@Teg79 Have you tried the latest version of the plugin? It's supposed to work with M1 by downloading the x64 version.

eirslett avatar Mar 19 '21 21:03 eirslett

I just hit the same problem with my M1 on 1.8.0 and after updating to 1.12.0 it works.

danskyr avatar May 28 '21 01:05 danskyr

手动强制架构 How do I force the schema manually

manbanpan avatar Jun 05 '21 02:06 manbanpan

Had the same issue with Debian x86_64. The solution was to upgrade my java8 version to a more recent one. (Actually installed [OpenJDK 64-Bit Server VM Corretto-8.302.08.1] instead of Oracle JDK.)

prampec avatar Oct 12 '21 09:10 prampec

Changing jdk from 1.8_202 to 1.8_333 in my system maven worked for me. I think this is an issue with 32 version of jdk. I'm working on linux. Check your jdk in your maven with this command in console: mvn -v, and try to change your jdk to version 64.

grpo@grpo:~/projekty/custom-gui/custom-gui-single-repo/custom-gui$ mvn -v Apache Maven 3.6.3 Maven home: /usr/share/maven Java version: 1.8.0_333, vendor: Oracle Corporation, runtime: /usr/lib/jvm/jdk1.8.0_333/jre Default locale: pl_PL, platform encoding: UTF-8 OS name: "linux", version: "5.14.0-1042-oem", arch: "amd64", family: "unix"

previously it was:

grpo@grpo:~/projekty/custom-gui/custom-gui-single-repo/custom-gui$ mvn -v Apache Maven 3.6.3 Maven home: /usr/share/maven Java version: 1.8.0_202, vendor: Oracle Corporation, runtime: /usr/lib/jvm/jdk1.8.0_202/jre Default locale: pl_PL, platform encoding: UTF-8 OS name: "linux", version: "5.14.0-1042-oem", arch: "i386", family: "unix"

grzechup avatar Jun 23 '22 10:06 grzechup