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

I don't know why it was detected as x86_32 and then tried to download node-v12.16.1-linux-x86.tar.gz and found 404 How to solve it? thank you #977

Open manbanpan opened 3 years ago

manbanpan commented 3 years ago

[INFO] os.detected.name: linux [INFO] os.detected.arch: x86_32 [INFO] os.detected.version: 3.10 [INFO] os.detected.version.major: 3 [INFO] os.detected.version.minor: 10 [INFO] os.detected.release: centos [INFO] os.detected.release.version: 7 [INFO] os.detected.release.like.centos: true [INFO] os.detected.release.like.rhel: true [INFO] os.detected.release.like.fedora: true [INFO] os.detected.classifier: linux-x86_32

[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ ui-ngx --- [INFO] [INFO] --- frontend-maven-plugin:1.7.5:install-node-and-yarn (install node and npm) @ ui-ngx --- [INFO] Installing node version v12.16.1 [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 [INFO] No proxies configured [INFO] No proxy was configured, downloading directly

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

Pom file <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

4.0.0
<parent>
    <groupId>org.ospthings</groupId>
    <version>3.1.1</version>
    <artifactId>ospthings</artifactId>
</parent>
<groupId>org.ospthings</groupId>
<artifactId>ui-ngx</artifactId>
<packaging>jar</packaging>

<name>OSPThings Server UI</name>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <main.dir>${basedir}/..</main.dir>
</properties>

<build>
    <resources>
        <resource>
            <directory>${project.build.directory}/generated-resources</directory>
        </resource>
    </resources>
    <plugins>
        <plugin>
            <groupId>com.github.eirslett</groupId>
            <artifactId>frontend-maven-plugin</artifactId>
            <version>1.12.0</version>
            <configuration>
                <installDirectory>target</installDirectory>
                <workingDirectory>${basedir}</workingDirectory>
            </configuration>
            <executions>
                <execution>
                    <id>install node and npm</id>
                    <goals>
                        <goal>install-node-and-yarn</goal>
                    </goals>
                    <configuration>
                        <nodeVersion>v12.16.1</nodeVersion>
                        <yarnVersion>v1.22.4</yarnVersion>
                      <!-- optional: where to download node from. Defaults to https://nodejs.org/dist/ -->
                      <!-- <nodeDownloadRoot>http://npm.taobao.org/mirrors/node/</nodeDownloadRoot> -->
                      <!-- optional: where to download yarn from. Defaults to https://github.com/yarnpkg/yarn/releases/download/ -->
                      <yarnDownloadRoot>http://npm.taobao.org/mirrors/yarn/</yarnDownloadRoot>
                    </configuration>
                </execution>
                <execution>
                    <id>yarn install</id>
                    <goals>
                        <goal>yarn</goal>
                    </goals>
                    <configuration>
                        <arguments>install</arguments>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
<profiles>
    <profile>
        <id>yarn-build</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>com.github.eirslett</groupId>
                    <artifactId>frontend-maven-plugin</artifactId>
                    <version>1.12.0</version>
                    <configuration>
                        <installDirectory>target</installDirectory>
                        <workingDirectory>${basedir}</workingDirectory>
                    </configuration>
                    <executions>
                        <execution>
                            <id>yarn build</id>
                            <goals>
                                <goal>yarn</goal>
                            </goals>
                            <configuration>
                                <arguments>run build:prod</arguments>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
    <profile>
        <id>yarn-start</id>
        <activation>
            <property>
                <name>yarn-start</name>
            </property>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>com.github.eirslett</groupId>
                    <artifactId>frontend-maven-plugin</artifactId>
                    <version>1.12.0</version>
                    <configuration>
                        <installDirectory>target</installDirectory>
                        <workingDirectory>${basedir}</workingDirectory>
                    </configuration>
                    <executions>
                        <execution>
                            <id>yarn start</id>
                            <goals>
                                <goal>yarn</goal>
                            </goals>
                            <configuration>
                                <arguments>start</arguments>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

eirslett commented 3 years ago

Do you run on a 32 bit computer? Is it some sort of IoT device, or a really old laptop?

manbanpan commented 3 years ago

The application is automatically deployed to the container cloud, the system is linux/arm64, how can it detect x86_32?

manbanpan commented 3 years ago

How do I specify the files to download?

eirslett commented 3 years ago

You can see in your test output: [INFO] os.detected.arch: x86_32 Maybe you need to upgrade your Maven version, Java version and the version of this plugin. I have no idea why it's guessing the wrong arch.

manbanpan commented 3 years ago

mvn -v Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T19:49:05Z) Maven home: /opt/apache-maven-3.5.3 Java version: 1.8.0_232, vendor: Oracle Corporation Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.i386/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "3.10.0-693.el7.x86_64", arch: "i386", family: "unix"

arch x86_64

Execute mvn-v command to display i386, Execute the arch command to display x86_64. Which is correct?

eirslett commented 3 years ago

Looks correct to me! So there's probably a bug in the code that reads environment data to guess the right architecture. You can find in it the file called Platform.java.

cesarjanuario82 commented 2 years ago

Same error, ¿any update?

Kuanlin-Chen commented 2 years ago

Same error, is there any way to specify arch as x64 to avoid the miss detection? It's so annoying.

manbanpan commented 2 years ago

Both commands are executed before the package command is executed.  export JAVA_HOME=/usr/lib/jvm/java-openjdk export JRE_HOME=$JAVA_HOME/jre

发自我的iPhone

------------------ Original ------------------ From: Corey @.> Date: Wed,Dec 15,2021 4:34 PM To: eirslett/frontend-maven-plugin @.> Cc: 搬运工 @.>, Author @.> Subject: Re: [eirslett/frontend-maven-plugin] I don't know why it was detectedas x86_32 and then tried to download node-v12.16.1-linux-x86.tar.gz and found404 How to solve it? thank you (#977)

Same error, is there any way to specify arch as x64 to avoid the miss detection? It's so annoying.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

Kuanlin-Chen commented 2 years ago

Both commands are executed before the package command is executed.  export JAVA_HOME=/usr/lib/jvm/java-openjdk export JRE_HOME=$JAVA_HOME/jre 发自我的iPhone ------------------ Original ------------------ From: Corey @.> Date: Wed,Dec 15,2021 4:34 PM To: eirslett/frontend-maven-plugin @.> Cc: 搬运工 @.>, Author @.> Subject: Re: [eirslett/frontend-maven-plugin] I don't know why it was detectedas x86_32 and then tried to download node-v12.16.1-linux-x86.tar.gz and found404 How to solve it? thank you (#977) Same error, is there any way to specify arch as x64 to avoid the miss detection? It's so annoying. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

It works! You definitely save my life, thanks!

To be clear, my OS is Ubuntu 18.04 x64 and I used Oracle JDK 1.8 to run mvn install in the beginning, it will cause a miss detection os.detected.arch: x86_32. After I export JAVA_HOME to OpenJDK 8, it resolved the issue, os.detected.arch will become x86_64, which is correct.

Kuanlin-Chen commented 2 years ago

Both commands are executed before the package command is executed. export JAVA_HOME=/usr/lib/jvm/java-openjdk export JRE_HOME=$JAVAHOME/jre 发自我的iPhone ------------------ Original ------------------ From: Corey @.> Date: Wed,Dec 15,2021 4:34 PM To: eirslett/frontend-maven-plugin _@_.> Cc: 搬运工 @.>, Author _@_._> Subject: Re: [eirslett/frontend-maven-plugin] I don't know why it was detectedas x86_32 and then tried to download node-v12.16.1-linux-x86.tar.gz and found404 How to solve it? thank you (#977) Same error, is there any way to specify arch as x64 to avoid the miss detection? It's so annoying. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

It works! You definitely save my life, thanks!

To be clear, my OS is Ubuntu 18.04 x64 and I used Oracle JDK 1.8 to run mvn install in the beginning, it will cause a miss detection os.detected.arch: x86_32. After I export JAVA_HOME to OpenJDK 8, it resolved the issue, os.detected.arch will become x86_64, which is correct.

Update the information, I miss-installed a 32bit Java on my computer, so it might not relevant to OpenJDK or Oracle JDK, this command helped me to troubleshoot the issue: java -d64 -version or java -d32 -version.

In addition, os.arch is not the bitness of the OS, but the JVM.

floverfelt commented 2 years ago

Dropping this here in case it helps anybody else who stumbled on this. If you need to hardcode the architecture for some reason (you need Java to be on 32bit but Node on 64bit for example), you can use the set-system-properties plugin before execution of the frontend-maven-plugin : https://github.com/mojohaus/properties-maven-plugin just specify the os.arch property to match whatever value you need from here: https://github.com/eirslett/frontend-maven-plugin/blob/master/frontend-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/Platform.java#L8