flow icon indicating copy to clipboard operation
flow copied to clipboard

CI build fails with `"esbuild": "0.13.0"` override in VAADIN 23.1.0

Open DManstrator opened this issue 2 years ago • 2 comments

Description of the bug

This might be related to #13624 since I also had issues with the postinstall esbuild (see my comment).

I added the override while using VAADIN 23.0.11 and my issue seemed to be resolved. However when updating from VAADIN 23.0.11 to VAADIN 23.1.0, this now errors during the CI build.

Notice: Building the application locally works fine, it's just not working in the CI environment. My previous issue with the postinstall esbuild also just happend in the CI environment and never locally.

What happend in order

When I added that override while using VAADIN 23.0.11, this section (amongst others) was added to the package-lock.json:

"optionalDependencies": {
  "esbuild-android-arm64": "0.13.0",
  "esbuild-darwin-64": "0.13.0",
  "esbuild-darwin-arm64": "0.13.0",
  "esbuild-freebsd-64": "0.13.0",
  "esbuild-freebsd-arm64": "0.13.0",
  "esbuild-linux-32": "0.13.0",
  "esbuild-linux-64": "0.13.0",
  "esbuild-linux-arm": "0.13.0",
  "esbuild-linux-arm64": "0.13.0",
  "esbuild-linux-mips64le": "0.13.0",
  "esbuild-linux-ppc64le": "0.13.0",
  "esbuild-openbsd-64": "0.13.0",
  "esbuild-sunos-64": "0.13.0",
  "esbuild-windows-32": "0.13.0",
  "esbuild-windows-64": "0.13.0",
  "esbuild-windows-arm64": "0.13.0"
}

After updating from VAADIN 23.0.11 to VAADIN 23.1.0, the package-lock.json was updated again with the following diff: package-lock.json-diff-after-vaadin-23-1-update.diff.txt (very big, thus added as a file)

After pushing this change, the build in the CI started to fail. But for some reason, this happens in a different plugin (frontend-maven-plugin).

[INFO] --- frontend-maven-plugin:1.12.1:npm (TypeScript install) @ project ---
[INFO] Running 'npm install typescript' in /builds/project
[INFO] npm ERR! code 1
[INFO] npm ERR! path /builds/project/node_modules/esbuild
[INFO] npm ERR! command failed
[INFO] npm ERR! command sh -c node install.js
[INFO] npm ERR! /builds/project/node_modules/esbuild/install.js:45
[INFO] npm ERR!       throw new Error(`The package "${pkg}" could not be found, and is needed by esbuild.
[INFO] npm ERR!       ^
[INFO] npm ERR! 
[INFO] npm ERR! Error: The package "esbuild-linux-64" could not be found, and is needed by esbuild.
[INFO] npm ERR! 
[INFO] npm ERR! If you are installing esbuild with npm, make sure that you don't specify the
[INFO] npm ERR! "--no-optional" flag. The "optionalDependencies" package.json feature is used
[INFO] npm ERR! by esbuild to install the correct binary executable for your current platform.
[INFO] npm ERR!     at pkgAndBinForCurrentPlatform (/builds/project/node_modules/esbuild/install.js:45:13)
[INFO] npm ERR!     at Object.<anonymous> (/builds/project/node_modules/esbuild/install.js:90:19)
[INFO] npm ERR!     at Module._compile (node:internal/modules/cjs/loader:1105:14)
[INFO] npm ERR!     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
[INFO] npm ERR!     at Module.load (node:internal/modules/cjs/loader:981:32)
[INFO] npm ERR!     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
[INFO] npm ERR!     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
[INFO] npm ERR!     at node:internal/main/run_main_module:17:47

The diff attached above only gets created when using VAADIN 23.1.0. When using VAADIN 23.0.11, this is not the case and due to that, the pipeline doesn't fail. Because of that, I think this is related to VAADIN even the error happens in a different plugin.

Expected behavior

The build is running through.

Minimal reproducible example

  1. Add the following plugin to the build:
<plugin>
    <groupId>com.github.eirslett</groupId>
    <artifactId>frontend-maven-plugin</artifactId>
    <version>1.12.1</version>
    <executions>
        <execution>
            <id>node installation</id>
            <goals>
                <goal>install-node-and-npm</goal>
            </goals>
            <configuration>
                <installDirectory>${project.basedir}</installDirectory>
            </configuration>
            <phase>generate-resources</phase>
        </execution>
        <execution>
            <id>TypeScript install</id>
            <goals>
                <goal>npm</goal>
            </goals>
            <configuration>
                <arguments>install typescript</arguments>
            </configuration>
            <phase>generate-resources</phase>
        </execution>
        <execution>
            <id>TypeScript compile</id>
            <goals>
                <goal>npm</goal>
            </goals>
            <configuration>
                <arguments>run tsc</arguments>
            </configuration>
            <phase>generate-resources</phase>
        </execution>
    </executions>
    <configuration>
        <nodeVersion>v16.15.1</nodeVersion>
    </configuration>
</plugin>
  1. Use VAADIN 23.0.11 (make sure package.json is also on 23.0.11).
  2. Add "esbuild": "0.13.0", to the overrides of the package.json.
  3. Build in production mode and commit / push the changes to the package-lock.json where a CI is building the project. The pipeline should pass.
  4. Update to VAADIN 23.1.0 and build in production mode. Push all changes again. The build in the CI should fail now.

If needed, I can also provide a sample project. But that should be everything.

Versions

  • Vaadin / Flow version: 23.1.0
  • Java version: 17.0.2 2022-01-18 LTS
  • OS version: Windows 10 21H1
  • Browser version (if applicable): Not needed.
  • Application Server (if applicable): Not needed.
  • IDE (if applicable): Not needed.

DManstrator avatar Jun 10 '22 10:06 DManstrator

Hi @DManstrator I followed your instructions but I was not able to reproduce the problem. A sample project may be very useful

mcollovati avatar Jul 13 '22 10:07 mcollovati

I've tested with the following configuration:

  1. Spring boot starter from start.vaadin.com
  2. Vaadin version 23.1.6
  3. frontend-maven-pluging configuration that you gave above
  4. "esbuild": "0.13.0" override in package.json

I got the following error:

[INFO] --- frontend-maven-plugin:1.12.1:npm (TypeScript compile) @ myapp ---
[INFO] Running 'npm run tsc' in /Users/mikhail/workspace/vaadin/reproduce/esbuild/my-app
[INFO] npm ERR! Missing script: "tsc"
[INFO] npm ERR! 
[INFO] npm ERR! To see a list of scripts, run:
[INFO] npm ERR!   npm run

But if I commented out the following lines:

<!--                    <execution>-->
<!--                        <id>TypeScript compile</id>-->
<!--                        <goals>-->
<!--                            <goal>npm</goal>-->
<!--                        </goals>-->
<!--                        <configuration>-->
<!--                            <arguments>run tsc</arguments>-->
<!--                        </configuration>-->
<!--                        <phase>generate-resources</phase>-->
<!--                    </execution>-->

the app starts and work fine.

@DManstrator could you please try with the Vaadin 23.1.6 (which is the latest for the moment and has a esbuild-loader updates)?

mshabarov avatar Aug 12 '22 12:08 mshabarov

Hello,

sorry for the late response, I didn't notice there were responses to this issue.

TL; DR: I'm not longer affected by this issue.

I initially added that frontend-maven-plugin configuration since postinstall support was removed with the release of VAADIN 23, see https://github.com/vaadin/flow/issues/13537#issuecomment-1098160289. With the release of VAADIN 23.1.1, it did work again so I removed that configuration. And with VAADIN 23.1.2, I was also able to remove that custom "esbuild": "0.13.0" override.

However, I still tested if that diff for the package-lock.json is still present but I was not able to reproduce it. So I would assume it works now.

But as said, both the override and that plugin configuration were workarounds so it's not in my main project anymore where I had the problems. And additionally, the problem only appeared in my CI environment, not locally. Due to that I think that issue can be marked as resolved.

Thanks again and sorry for the late response.

DManstrator avatar Sep 05 '22 13:09 DManstrator