0

I am trying to run this Vaadin Flow tutorial:

… according to these set-up instructions:

When I tried to run, I got various errors.

I am running on a MacBook Pro (13-inch, M1, 2020), with Apple M1 chip (ARM AArch64, not Intel x86), 16 gigs of memory, macOS Big Sur 11.6, Java 17 (update 35).

Highlights I noticed in errors:

  • ERROR 17373 --- [ restartedMain] c.v.f.s.frontend.FrontendToolsLocator : Failed to execute the command '[/Users/basil_dot_work/.vaadin/node/node, -v]'
  • java.io.IOException: Cannot run program "/Users/basil_dot_work/.vaadin/node/node": error=86, Bad CPU type in executable
  • Caused by: java.io.IOException: error=86, Bad CPU type in executable

That sounds suspiciously like an ARM chip incompatibility.

Also noticed:

  • INFO 17373 --- [ restartedMain] c.v.flow.server.frontend.FrontendTools : Couldn't find node. Installing Node and NPM to /Users/basil_dot_work/.vaadin.
  • ERROR 17373 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Exception sending context initialized event to listener instance of class [com.vaadin.flow.spring.VaadinServletContextInitializer$CompositeServletContextListener]

… and more.

➥ How might I modify this project to run?

I would very much prefer to avoid installing and running Rosetta 2.

I am not familiar with Spring Boot.

I tried updating all the versions listed in the POM to their latest. But that did not help. I seemed to continue getting errors related to ARM chip incompatibility.

Here is the original POM file.

<?xml version="1.0" encoding="UTF-8"?>
<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">
    <modelVersion>4.0.0</modelVersion>
    <!-- Vaadin project from https://start.vaadin.com/project/53571864-5e36-488b-8d11-d91844066446 -->
    <groupId>com.example.application</groupId>
    <artifactId>flowcrmtutorial</artifactId>
    <name>Project base for Spring Boot and Vaadin Flow</name>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <properties>
        <java.version>16</java.version>
        <vaadin.version>14.7.0</vaadin.version>
    </properties>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.4.5</version>
    </parent>

    <repositories>
        <!-- The order of definitions matters. Explicitly defining central here to make sure it has the highest priority. -->

        <!-- Main Maven repository -->
        <repository>
            <id>central</id>
            <url>https://repo.maven.apache.org/maven2</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <!-- Repository used by many Vaadin add-ons -->
        <repository>
            <id>Vaadin Directory</id>
            <url>https://maven.vaadin.com/vaadin-addons</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

    <pluginRepositories>
        <!-- Main Maven repository -->
        <pluginRepository>
            <id>central</id>
            <url>https://repo.maven.apache.org/maven2</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-bom</artifactId>
                <version>${vaadin.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>com.vaadin</groupId>
            <!-- Replace artifactId with vaadin-core to use only free components -->
            <artifactId>vaadin</artifactId>
            <exclusions>
                <!-- Webjars are only needed when running in Vaadin 13 compatibility mode -->
                <exclusion>
                    <groupId>com.vaadin.webjar</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.webjars.bowergithub.insites</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.webjars.bowergithub.polymer</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.webjars.bowergithub.polymerelements</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.webjars.bowergithub.vaadin</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.webjars.bowergithub.webcomponents</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-spring-boot-starter</artifactId>
            <exclusions>
                <!-- Excluding so that webjars are not included. -->
                <exclusion>
                    <groupId>com.vaadin</groupId>
                    <artifactId>vaadin-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.vaadin.artur</groupId>
            <artifactId>a-vaadin-helper</artifactId>
            <version>1.7.1</version>
        </dependency>

        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>exampledata</artifactId>
            <version>4.0.0</version>
        </dependency>

        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-testbench</artifactId>
            <scope>test</scope>
        </dependency>
        <!-- Include JUnit 4 support for TestBench and others -->
        <dependency>
            <groupId>org.junit.vintage</groupId>
            <artifactId>junit-vintage-engine</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.hamcrest</groupId>
                    <artifactId>hamcrest-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>io.github.bonigarcia</groupId>
            <artifactId>webdrivermanager</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <defaultGoal>spring-boot:run</defaultGoal>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <!-- Clean build and startup time for Vaadin apps sometimes may exceed
                     the default Spring Boot's 30sec timeout.  -->
                <configuration>
                    <wait>500</wait>
                    <maxAttempts>240</maxAttempts>
                </configuration>
            </plugin>

            <!--
                Take care of synchronizing java dependencies and imports in
                package.json and main.js files.
                It also creates webpack.config.js if not exists yet.
            -->
            <plugin>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-maven-plugin</artifactId>
                <version>${vaadin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-frontend</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <!-- Production mode is activated using -Pproduction -->
            <id>production</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.vaadin</groupId>
                        <artifactId>vaadin-maven-plugin</artifactId>
                        <version>${vaadin.version}</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>build-frontend</goal>
                                </goals>
                                <phase>compile</phase>
                            </execution>
                        </executions>
                        <configuration>
                             <productionMode>true</productionMode>
                            <pnpmEnable>false</pnpmEnable>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>it</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>start-spring-boot</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>start</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>stop-spring-boot</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>stop</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Runs the integration tests (*IT) after the server is started -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>integration-test</goal>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <trimStackTrace>false</trimStackTrace>
                            <enableAssertions>true</enableAssertions>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

    </profiles>
</project>
Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
  • I don't have an M1 Mac, but I'd try installing node and rpm yourself like this: https://justinwride.medium.com/install-node-and-npm-natively-on-apple-silicon-mac-m1-7432c826389b (random link I googled) – tgdavies Sep 25 '21 at 06:11
  • When I build that project it uses my installed rpm and node versions, so hopefully it will do the same for you: `Your installed 'node' version (8.9.0) is not supported but should still work...` and `Your installed 'npm' version (5.5.1) is not supported but should still work...` – tgdavies Sep 25 '21 at 06:19
  • @tgdavies I have not installed Node or npm myself. I thought Vaadin Flow had evolved to handle node/npm by itself internally without me needing to externally install. – Basil Bourque Sep 25 '21 at 06:51
  • @BasilBourque Vaadin should handle the node version for M1 also. Could you check what version was installed to `.vaadin`? The package should stay there with the full name so for instance `node-v16.7.0-win-x64.zip`. For 14.7 I think the default is `v14.15.4` so it should get the X64 version of node for the M1 as ARM is supported only from 16.x onward. You can change the auto installed version by giving the `node.version` property for instance for the Maven plugin `v16.10.0` – Mikael Grankvist Sep 27 '21 at 04:13
  • @BasilBourque Do you happen to have Rosetta installed? I don't remember having that kind of issue when using Vaadin, only when tried to compiled it when I moved to M1 Mac. It might be that we should define Rosetta as requirement for M1 Macs until new LTS of node is out and tested with Vaadin. – mstahv Sep 27 '21 at 05:22
  • @mstahv I have tried to avoid Rosetta. But I do not know [how to tell if Rosetta 2 is installed/activated](https://apple.stackexchange.com/q/427970/17907). – Basil Bourque Sep 27 '21 at 06:33
  • @MikaelGrankvist I found my `.vaadin` folder has `node/node`. When I run that node with `--version`, I get `zsh: bad CPU type in executable` error message. In that `.vaadin` folder I also found `node-v14.15.4-darwin-x64.tar.gz`. So obviously Vaadin is trying to install Node/npm, but used the x86 version rather than Apple Silicon version. As noted in [my Answer](https://stackoverflow.com/a/69339593/642706), there *is* an M1-native build of Node/npm available, version 16.10.0. Lastly, just now I deleted the `.vaadin` folder as it is not doing me any good. – Basil Bourque Sep 27 '21 at 06:40
  • So it works as expected as v14 still depends on the LTS version of nodejs which is still v14.x and will be updated as soon as v16 becomes the LTS of nodejs. There already is functionality that installs the arm version when the nodejs version is such that it supports M1 (so after it gets to v16.0) – Mikael Grankvist Sep 27 '21 at 07:11

2 Answers2

0

Vaadin Flow 14 versus 22

The Question asks about the Vaadin 14 + Spring Boot tutorial by Marcus Hellberg. As of 2021-09-30, Hellberg has posted a new version of that tutorial aimed at Vaadin 22 rather than 14. This Answer addresses the version 22 tutorial.

Install pnpm first, then Node.js & npm

Vaadin Flow relies on some third-party tools to accomplish its JavaScript & Web Components chores. Those tools include:

Later versions of Vaadin Flow are designed to auto-install these tools with Vaadin itself. Unfortunately, that auto-install fails on Macs having Apple Silicon. I presume this failure will be fixed in the future, but for now follow this workaround: Install those three tools on your Mac. Vaadin Flow will then be able to find and use those tools, thereby making moot the auto-install problem.

One key issue is that you must install pnpm on your Mac first. Only after that should you install Node.js (which also installs npm). I did the reverse, and experienced problems that I could only fix by painstakingly removing every one of the many pieces in many places installed by Node.js & npm.

Install pnpm

Installing pnpm is a not straightforward, as no installer app is available.

  1. In your home folder, create an empty text file named exactly .zshrc. The Z shell is the default shell for terminal work on macOS Big Sur. The .zshrc file is a place to put configuration commands that take effect when you start a new shell session (a new window/tab in Terminal.app). Search to learn more.
  2. As shown here, in Terminal.app run this line sudo curl -fsSL https://get.pnpm.io/install.sh | sh -. This downloads and executes a shell script which performs the installation of pnpm. You will be prompted for your admin password (Caveat emptor).

If the installation was successful, you will find that .zshrc is no longer empty:

export PNPM_HOME="/Users/your_user_name/Library/pnpm"
export PATH="$PNPM_HOME:$PATH"

Install Node.js and npm

Now proceed with the installation of Node.js & npm.

Another key issue with the auto-install failure is that the current mainstream version of Node.js is not yet native to the Apple M1 chip. I used this Answer to learn that for an M1 MacBook (ARM chip) I needed to get the bleeding-edge version 16.10.0 of NodeJS installer.

Downloading and running that installer successfully installed an Apple Silicon native version of Node & npm. Having those installed allowed that Vaadin tutorial app to run.

screenshot of NodeJS installer for Apple Silicon native version

Uninstalling

Uninstalling pnpm, Node.js, and npm is not a simple matter. You must search the web for tips posted by various people where they list all the nooks and crannies in your file system where you might find folders and files to be deleted.

Doing all those deletions is laborious, be forewarned. This is why the Vaadin team added that functionality to auto-install these tools within the Vaadin environment. Unfortunately, until that auto-install feature is fixed for M1 Macs, we on the bleeding-edge of processor technology need to do this manual install, and later, uninstall. Not the end of the world, just a chore; a small price to pay for the wonderful benefits of Vaadin Flow.

Security caveat

Be aware that JavaScript tooling such as pnpm, Node.js, and npm carry significant security risks.

  • Read up on the issues, for your own education and judgment.
  • Follow the steps listed here at your own risk. No guarantees, warranty, or responsibility is provided by me.

Frankly, I have become concerned enough about this risk that I no longer do any development work with these tools on any computer with sensitive personal info or apps. I now do development work only on separate machines dedicated to that purpose.


By the way, I found that after I installed Node/npm, I could also (a) change from Java 16 to 17, and (b) update all the versions in the POM to their latest. The Vaadin tutorial app continued to run successfully after these updates.

So my POM looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<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">
    <modelVersion>4.0.0</modelVersion>
    <!-- Vaadin project from https://start.vaadin.com/project/53571864-5e36-488b-8d11-d91844066446 -->
    <groupId>com.example.application</groupId>
    <artifactId>flowcrmtutorial</artifactId>
    <name>Project base for Spring Boot and Vaadin Flow</name>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <properties>
        <java.version>17</java.version>
        <vaadin.version>14.7.0</vaadin.version>
    </properties>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.5.5</version>
    </parent>

    <repositories>
        <!-- The order of definitions matters. Explicitly defining central here to make sure it has the highest priority. -->

        <!-- Main Maven repository -->
        <repository>
            <id>central</id>
            <url>https://repo.maven.apache.org/maven2</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <!-- Repository used by many Vaadin add-ons -->
        <repository>
            <id>Vaadin Directory</id>
            <url>https://maven.vaadin.com/vaadin-addons</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

    <pluginRepositories>
        <!-- Main Maven repository -->
        <pluginRepository>
            <id>central</id>
            <url>https://repo.maven.apache.org/maven2</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-bom</artifactId>
                <version>${vaadin.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>com.vaadin</groupId>
            <!-- Replace artifactId with vaadin-core to use only free components -->
            <artifactId>vaadin</artifactId>
            <exclusions>
                <!-- Webjars are only needed when running in Vaadin 13 compatibility mode -->
                <exclusion>
                    <groupId>com.vaadin.webjar</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.webjars.bowergithub.insites</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.webjars.bowergithub.polymer</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.webjars.bowergithub.polymerelements</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.webjars.bowergithub.vaadin</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.webjars.bowergithub.webcomponents</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-spring-boot-starter</artifactId>
            <exclusions>
                <!-- Excluding so that webjars are not included. -->
                <exclusion>
                    <groupId>com.vaadin</groupId>
                    <artifactId>vaadin-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.vaadin.artur</groupId>
            <artifactId>a-vaadin-helper</artifactId>
            <version>1.7.2</version>
        </dependency>

        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>exampledata</artifactId>
            <version>4.0.0</version>
        </dependency>

        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-testbench</artifactId>
            <scope>test</scope>
        </dependency>
        <!-- Include JUnit 4 support for TestBench and others -->
        <dependency>
            <groupId>org.junit.vintage</groupId>
            <artifactId>junit-vintage-engine</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.hamcrest</groupId>
                    <artifactId>hamcrest-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>io.github.bonigarcia</groupId>
            <artifactId>webdrivermanager</artifactId>
            <version>5.0.3</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <defaultGoal>spring-boot:run</defaultGoal>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <!-- Clean build and startup time for Vaadin apps sometimes may exceed
                     the default Spring Boot's 30sec timeout.  -->
                <configuration>
                    <wait>500</wait>
                    <maxAttempts>240</maxAttempts>
                </configuration>
            </plugin>

            <!--
                Take care of synchronizing java dependencies and imports in
                package.json and main.js files.
                It also creates webpack.config.js if not exists yet.
            -->
            <plugin>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-maven-plugin</artifactId>
                <version>${vaadin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-frontend</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <!-- Production mode is activated using -Pproduction -->
            <id>production</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.vaadin</groupId>
                        <artifactId>vaadin-maven-plugin</artifactId>
                        <version>${vaadin.version}</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>build-frontend</goal>
                                </goals>
                                <phase>compile</phase>
                            </execution>
                        </executions>
                        <configuration>
                             <productionMode>true</productionMode>
                            <pnpmEnable>false</pnpmEnable>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>it</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>start-spring-boot</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>start</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>stop-spring-boot</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>stop</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Runs the integration tests (*IT) after the server is started -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>integration-test</goal>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <trimStackTrace>false</trimStackTrace>
                            <enableAssertions>true</enableAssertions>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

    </profiles>
</project>
Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
  • To disable pnpm and use npm set to false the pnpm enable property. As maven configuration `pnpmEnable` and as system property `vaadin.pnpm.enable` – Mikael Grankvist Oct 05 '21 at 04:12
0

At the moment Vaadin 14LTS is depending on the Nodejs LTS which is 14.x which does not have a M1 compatible package yet so the installed version is x64 that requires Rosetta.

At the moment to get the M1 compatible version installed with V14 the property node.version needs to be given such that it is at least v16.0.0 preferably the latest one which at time of writing is v16.10.0.

So for maven pom it would mean

<plugin>
  <groupId>com.vaadin</groupId>
  <artifactId>vaadin-maven-plugin</artifactId>

  ...

  <configuration>
    <nodeVersion>v16.10.0</nodeVersion>
  </configuration>
</plugin>

This will install the v16 version when no version is available in ~/.vaadin or globally.

  • I see `vaadin-maven-plugin` entry twice in the POM. To which should we add the `configuration` tag? Or both? – Basil Bourque Sep 27 '21 at 07:25
  • If you add it in the initial it should also be applied to the extending profile one. – Mikael Grankvist Sep 27 '21 at 07:53
  • Did not work for me. I uninstalled my previous install of Node.js (having used a downloaded .pkg, not using Brew) by running `sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp`. I then added your `configuration` element to the ` spring-boot:run ` > ` com.vaadin vaadin-maven-plugin`. Now when I run the Spring Boot Vaadin tutorial, I get errors about o.s.boot.SpringApplication run failed, and Unable to start embedded Tomcat. – Basil Bourque Sep 29 '21 at 21:08
  • Did you also remove `~/.vaadin/node` and `~/.vaadin/node_modules` ? What version did it download? There should be a log output of from the installer as something like `[main] INFO NodeInstaller - Installing node version v14.15.4` `INFO NodeInstaller - Downloading https://nodejs.org/dist/v14.15.4/node-v14.15.4-win-x64.zip to ~/.vaadin/node-v14.15.4-win-x64.zip` – Mikael Grankvist Sep 30 '21 at 03:50
  • I tried (a) switch to the new version of the [Vaadin Flow + Spring Boot tutorial](https://vaadin.com/docs/latest/flow/tutorials/in-depth-course) for Vaadin Flow 22 rather than 14, and (b) Manually deleting all traces of my installations of Node.js, npm, and pnpm. And I deleted `.vaadin` folder in my home directory, per your suggestion. With a fresh new copy of the tutorial, modified by adding your `configuration` tag, I get an error: “c.v.f.s.frontend.TaskUpdatePackages : Error when running `npm install`” . – Basil Bourque Oct 03 '21 at 06:36
  • … followed by “java.io.IOException: Cannot run program "--no-update-notifier" (in directory "/Users/basil_dot_work/IdeaProjects/flow-crm-tutorial"): error=2, No such file or directory” – Basil Bourque Oct 03 '21 at 06:39
  • I'll try to get someone internal with a M1 Mac to help with this issue. – Mikael Grankvist Oct 04 '21 at 07:44
  • @BasilBourque Would you try adding vaadin.require.home.node=true Environment variable to your launch configuration of the Application class in IntelliJ IDEA ? The pom.xml configuration doesn't affect if you launch the Application class directly from the IDE. My setup was using the global node installation until I set that. After that set, node-v16.7.0-darwin-arm64 gets downloaded with Vaadin 22. Otherwise the older intel build gets used for me (and works fine as I have Rosetta2 installed) – mstahv Oct 04 '21 at 10:32
  • @mstahv I trashed my existing tutorial app, downloaded a fresh one which had changed (now set to Vaadin 22 alpha 6). Verified that I had no node, npm, nor pnpm installed. I invalidated caches on IntelliJ, restarted, and created new project. I changed `` from Java 16 to 17 in the POM. I made sure the `.vaadin` folder in my user home folder was empty. I edited the IntelliJ Run/Debug Configuration to paste `vaadin.require.home.node=true` in the *Environment variables* field. Then clicked green triangle on `main` of `Application` class. … – Basil Bourque Oct 05 '21 at 00:32
  • … My default web browser launched, with page showing error: “Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback. … unexpected error (type=Internal Server Error, status=500). …”. The *Run* console in IntelliJ shows “ERROR 1000 --- [onPool-worker-1] NodeInstaller : The archive file /Users/basil_dot_work/.vaadin/node-v16.7.0-darwin-arm64.tar.gz is corrupted and will be deleted. Please run the application again.” and … – Basil Bourque Oct 05 '21 at 00:36
  • … “ERROR 1000 --- [nio-8080-exec-1] c.v.flow.server.DefaultErrorHandler : java.lang.IllegalStateException: com.vaadin.flow.server.ExecutionFailedException: Failed to install Node” and “ERROR 1000 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[springServlet] : Servlet.service() for servlet [springServlet] threw exception java.io.EOFException: null” and several more errors apparently cascading from a failure to start. – Basil Bourque Oct 05 '21 at 00:37
  • The corrupted information is because the file was not completely downloaded and extraction failed with an `EOFException` – Mikael Grankvist Oct 05 '21 at 10:45