Vaadin production mode builds broken in v20?
Asked Answered
D

1

8

Recently our vaadin production build has started failing and I'm too much of a node noob to figure out if this is a local problem or if it is related to vaadin 20.

When I switch back to vaadin 19 the problem goes away and I can reproduce the problem with an application generated on https://start.vaadin.com/app/

When running: ./mvnw package -P production I get the following error:

[INFO] -------------------< com.example.application:myapp >--------------------
[INFO] Building Project base for Spring Boot and Vaadin Flow 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ myapp ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 1 resource
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ myapp ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- vaadin-maven-plugin:20.0.5:prepare-frontend (default) @ myapp ---
[INFO] Copying frontend resources from jar files ...
[INFO] Visited 163 resources. Took 88 ms.
[INFO]
[INFO] --- vaadin-maven-plugin:20.0.5:build-frontend (default) @ myapp ---
[INFO] Scanning classes to find frontend configurations and dependencies...
[INFO] Visited 1876 classes. Took 1089 ms.
[INFO] Visited 108 classes. Took 31 ms.
[INFO] Skipping `pnpm install` because the frontend packages are already installed in the folder '/home/me/devel/my-app/node_modules' and the hash in the file '/home/me/devel/my-app/node_modules/.vaadin/vaadin.json' is the same as in 'package.json'
[INFO] Copying frontend resources from jar files ...
[INFO] Visited 163 resources. Took 45 ms.
[INFO] Running webpack ...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  6.769 s
[INFO] Finished at: 2021-08-06T13:40:23+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.vaadin:vaadin-maven-plugin:20.0.5:build-frontend (default) on project myapp: Execution default of goal com.vaadin:vaadin-maven-plugin:20.0.5:build-frontend failed: Webpack process exited with non-zero exit code.
[ERROR] Stderr: '/home/me/devel/my-app/node_modules/.pnpm/[email protected][email protected]/node_modules/webpack-cli/bin/cli.js:93
[ERROR]                 throw err;
[ERROR]                 ^
[ERROR]
[ERROR] Error: Cannot find module 'workbox-build/build/options/schema/webpack-generate-sw'
[ERROR] Require stack:
[ERROR] - /home/me/devel/my-app/node_modules/.pnpm/[email protected][email protected]/node_modules/workbox-webpack-plugin/build/generate-sw.js
[ERROR] - /home/me/devel/my-app/node_modules/.pnpm/[email protected][email protected]/node_modules/workbox-webpack-plugin/build/index.js
[ERROR] - /home/me/devel/my-app/webpack.generated.js
[ERROR] - /home/me/devel/my-app/webpack.config.js
[ERROR] - /home/me/devel/my-app/node_modules/.pnpm/[email protected][email protected]/node_modules/webpack-cli/bin/utils/convert-argv.js
[ERROR] - /home/me/devel/my-app/node_modules/.pnpm/[email protected][email protected]/node_modules/webpack-cli/bin/cli.js
[ERROR] - /home/me/devel/my-app/node_modules/.pnpm/[email protected][email protected]/node_modules/webpack/bin/webpack.js
[ERROR]     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
[ERROR]     at Function.Module._load (node:internal/modules/cjs/loader:778:27)
[ERROR]     at Module.require (node:internal/modules/cjs/loader:1005:19)
[ERROR]     at require (/home/me/devel/my-app/node_modules/.pnpm/[email protected]/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
[ERROR]     at Object.<anonymous> (/home/me/devel/my-app/node_modules/.pnpm/[email protected][email protected]/node_modules/workbox-webpack-plugin/build/generate-sw.js:20:33)
[ERROR]     at Module._compile (/home/me/devel/my-app/node_modules/.pnpm/[email protected]/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
[ERROR]     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
[ERROR]     at Module.load (node:internal/modules/cjs/loader:981:32)
[ERROR]     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
[ERROR]     at Module.require (node:internal/modules/cjs/loader:1005:19)
[ERROR]     at require (/home/me/devel/my-app/node_modules/.pnpm/[email protected]/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
[ERROR]     at Object.<anonymous> (/home/me/devel/my-app/node_modules/.pnpm/[email protected][email protected]/node_modules/workbox-webpack-plugin/build/index.js:10:20)
[ERROR]     at Module._compile (/home/me/devel/my-app/node_modules/.pnpm/[email protected]/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
[ERROR]     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
[ERROR]     at Module.load (node:internal/modules/cjs/loader:981:32)
[ERROR]     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
[ERROR]     at Module.require (node:internal/modules/cjs/loader:1005:19)
[ERROR]     at require (/home/me/devel/my-app/node_modules/.pnpm/[email protected]/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
[ERROR]     at Object.<anonymous> (/home/me/devel/my-app/webpack.generated.js:10:28)
[ERROR]     at Module._compile (/home/me/devel/my-app/node_modules/.pnpm/[email protected]/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
[ERROR]     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
[ERROR]     at Module.load (node:internal/modules/cjs/loader:981:32)
[ERROR]     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
[ERROR]     at Module.require (node:internal/modules/cjs/loader:1005:19)
[ERROR]     at require (/home/me/devel/my-app/node_modules/.pnpm/[email protected]/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
[ERROR]     at Object.<anonymous> (/home/me/devel/my-app/webpack.config.js:10:22)
[ERROR]     at Module._compile (/home/me/devel/my-app/node_modules/.pnpm/[email protected]/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
[ERROR]     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
[ERROR]     at Module.load (node:internal/modules/cjs/loader:981:32)
[ERROR]     at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
[ERROR]   code: 'MODULE_NOT_FOUND',
[ERROR]   requireStack: [
[ERROR]     '/home/me/devel/my-app/node_modules/.pnpm/[email protected][email protected]/node_modules/workbox-webpack-plugin/build/generate-sw.js',
[ERROR]     '/home/me/devel/my-app/node_modules/.pnpm/[email protected][email protected]/node_modules/workbox-webpack-plugin/build/index.js',
[ERROR]     '/home/me/devel/my-app/webpack.generated.js',
[ERROR]     '/home/me/devel/my-app/webpack.config.js',
[ERROR]     '/home/me/devel/my-app/node_modules/.pnpm/[email protected][email protected]/node_modules/webpack-cli/bin/utils/convert-argv.js',
[ERROR]     '/home/me/devel/my-app/node_modules/.pnpm/[email protected][email protected]/node_modules/webpack-cli/bin/cli.js',
[ERROR]     '/home/me/devel/my-app/node_modules/.pnpm/[email protected][email protected]/node_modules/webpack/bin/webpack.js'
[ERROR]   ]
[ERROR] }
[ERROR] ': Unexpected exit value: 1, allowed exit values: [0], executed command [/usr/local/bin/node, /home/me/devel/my-app/node_modules/webpack/bin/webpack.js] in directory /home/me/devel/my-app with environment { redacted }, output was 5013 bytes (truncated):
[ERROR] /home/me/devel/my-app/node_modules/.pnpm/[email protected][email protected]/node_modules/webpack-cli/bin/cli.js:93
[ERROR]                 throw err;
[ERROR]                 ^
[ERROR]
[ERROR] Error: Cannot find module 'workbox-build/build/options/schema/webpack-generate-sw'
[ERROR] Require stack:
[ERROR] - /home/me/devel/my-app/node_modules/.pnpm/[email protected][email protected]/node_modules/workbox-webpack-plugin/build/generate-sw.js
[ERROR] - /home/me/devel/my-app/node_modules/.pnpm/[email protected][email protected]/node_modules/workbox-webpack-plugin/build/index.js
[ERROR] - /home/me/devel/my-app/webpack.generated.js
[ERROR] - /home/me/devel/my-app/webpack.config.js
[ERROR] - /home/me/devel/my-app/node_modules/.pnpm/[email protected][email protected]/node_modules/webpack-cli/bin/utils/convert-argv.js
[ERROR] - /home/me/devel/my-app/node_modules/.pnpm/[email protected][email protected]/node_modules/webpack-cli/bin/cli.js
[ERROR] - /home/me/devel/my-app/node_modules/.pnpm/[email protected][email protected]/node_modules/webpack/bin/webpack.js
[ERROR]     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
[ERROR]     at Function.Module._load (node:internal/modules/cjs/loader:778:27)
[ERROR]     at Module.require (node:internal/modules/cjs/loader:1005:19)
[ERROR]     at require (/home/me/devel/my-app/node_modules/.pnpm/[email protected]/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
[ERROR]     at Object.<anonymous> (/home/me/devel/my-app/node_modules/.pnpm/[email protected][email protected]/node_modules/workbox-webpack-plugin/build/generate-sw.js:20:33)
[ERROR]     at Module._compile (/home/me/devel/my-app/node_modules/.pnpm/[email protected]/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
[ERROR]     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
[ERROR]     at Module.load (node:internal/modules/cjs/loader:981:32)
[ERROR]     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
[ERROR]     at Module.require (node:internal/modules/cjs/loader:1005:19)
[ERROR]     at require (/home/me/devel/my-app/node_modules/.pnpm/[email protected]/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
[ERROR]     at Object.<anonymous> (/home/me/devel/my-app/node_modules/.pnpm/[email protected][email protected]/node_modules/workbox-webpack-plugin/build/index.js:10:20)
[ERROR]     at Module._compile (/home/me/devel/my-app/node_modules/.pnpm/[email protected]/node_modul
[ERROR] ...
[ERROR] -cache/v8-compile-cache.js:192:30)
[ERROR]     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
[ERROR]     at Module.load (node:internal/modules/cjs/loader:981:32)
[ERROR]     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
[ERROR]     at Module.require (node:internal/modules/cjs/loader:1005:19)
[ERROR]     at require (/home/me/devel/my-app/node_modules/.pnpm/[email protected]/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
[ERROR]     at Object.<anonymous> (/home/me/devel/my-app/webpack.generated.js:10:28)
[ERROR]     at Module._compile (/home/me/devel/my-app/node_modules/.pnpm/[email protected]/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
[ERROR]     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
[ERROR]     at Module.load (node:internal/modules/cjs/loader:981:32)
[ERROR]     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
[ERROR]     at Module.require (node:internal/modules/cjs/loader:1005:19)
[ERROR]     at require (/home/me/devel/my-app/node_modules/.pnpm/[email protected]/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
[ERROR]     at Object.<anonymous> (/home/me/devel/my-app/webpack.config.js:10:22)
[ERROR]     at Module._compile (/home/me/devel/my-app/node_modules/.pnpm/[email protected]/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
[ERROR]     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
[ERROR]     at Module.load (node:internal/modules/cjs/loader:981:32)
[ERROR]     at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
[ERROR]   code: 'MODULE_NOT_FOUND',
[ERROR]   requireStack: [
[ERROR]     '/home/me/devel/my-app/node_modules/.pnpm/[email protected][email protected]/node_modules/workbox-webpack-plugin/build/generate-sw.js',
[ERROR]     '/home/me/devel/my-app/node_modules/.pnpm/[email protected][email protected]/node_modules/workbox-webpack-plugin/build/index.js',
[ERROR]     '/home/me/devel/my-app/webpack.generated.js',
[ERROR]     '/home/me/devel/my-app/webpack.config.js',
[ERROR]     '/home/me/devel/my-app/node_modules/.pnpm/[email protected][email protected]/node_modules/webpack-cli/bin/utils/convert-argv.js',
[ERROR]     '/home/me/devel/my-app/node_modules/.pnpm/[email protected][email protected]/node_modules/webpack-cli/bin/cli.js',
[ERROR]     '/home/me/devel/my-app/node_modules/.pnpm/[email protected][email protected]/node_modules/webpack/bin/webpack.js'
[ERROR]   ]
[ERROR] }

On my local machine (macOs 11.4) I have node v16.6.1 installed, but it also fails on our jenkins server where node is not installed.

Best regards Jens

Driven answered 6/8, 2021 at 11:58 Comment(4)
After looking a little more at this, my suspicion is that it is a node repository problem. I can see that it did build on our Jenkins server with Vaadin 20.0.3 yesterday.Catamite
I can reproduce your problem by simply creating a new project on start.vaadin.comKimono
The recommended workaround until the fix is out is to bump webpack-cli to 3.3.12 and workbox-xxx dependencies to 6.2.0 in the project's package.json.Mccarver
How could I force the use of the package you say? the package.json isn't automatically rewritten every time?Keddah
J
8

This is a webpack problem and is being currently addressed via https://github.com/vaadin/flow/pull/11527

Edit: The fix is included in the latest Vaadin 20.0.6 release via Vaadin Flow 7.0.6.

Jaquelin answered 6/8, 2021 at 12:18 Comment(8)
Great, thanks. I expect there will be a v20.0.6 out shortly with the fix.Catamite
We didn't have time to get it out this week (it's 7:30 pm here in Finland so pretty much everyone has already left for the weekend), but hopefully next week. Unless webpack manages to get a fixed version out during the weekend, in which case the problem might fix itself automatically :)Jaquelin
20.0.6 has just been released with the fixJaquelin
I can confirm that 20.0.6 resolves the problem.Catamite
This happens also with 21.0.0.beta1Ainslee
Yes, it's been fixed in 22.0.0.alpha1 already, but the new 21 beta build is still underway.Jaquelin
@JensMøller are you sure is fixed in 20.0.6 I have just tried this version and I found the bug.Keddah
Yeah, I'm sure, but perhaps you need to delete your package.json file or update the dependencies as described in #68681711Catamite

© 2022 - 2024 — McMap. All rights reserved.