Vaadin 生产模式构建在 v20 中损坏了吗?

Vaadin production mode builds broken in v20?

最近我们的 vaadin 生产构建开始失败,我是一个节点菜鸟,无法确定这是本地问题还是与 vaadin 20 相关。

当我切换回 vaadin 19 时,问题消失了,我可以使用在 https://start.vaadin.com/app/

上生成的应用程序重现该问题

当 运行: ./mvnw package -P production 我得到以下错误:

[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/webpack-cli@3.3.11_webpack@4.46.0/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/workbox-webpack-plugin@6.1.0_webpack@4.46.0/node_modules/workbox-webpack-plugin/build/generate-sw.js
[ERROR] - /home/me/devel/my-app/node_modules/.pnpm/workbox-webpack-plugin@6.1.0_webpack@4.46.0/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/webpack-cli@3.3.11_webpack@4.46.0/node_modules/webpack-cli/bin/utils/convert-argv.js
[ERROR] - /home/me/devel/my-app/node_modules/.pnpm/webpack-cli@3.3.11_webpack@4.46.0/node_modules/webpack-cli/bin/cli.js
[ERROR] - /home/me/devel/my-app/node_modules/.pnpm/webpack@4.46.0_webpack-cli@3.3.11/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/v8-compile-cache@2.0.3/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
[ERROR]     at Object.<anonymous> (/home/me/devel/my-app/node_modules/.pnpm/workbox-webpack-plugin@6.1.0_webpack@4.46.0/node_modules/workbox-webpack-plugin/build/generate-sw.js:20:33)
[ERROR]     at Module._compile (/home/me/devel/my-app/node_modules/.pnpm/v8-compile-cache@2.0.3/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/v8-compile-cache@2.0.3/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
[ERROR]     at Object.<anonymous> (/home/me/devel/my-app/node_modules/.pnpm/workbox-webpack-plugin@6.1.0_webpack@4.46.0/node_modules/workbox-webpack-plugin/build/index.js:10:20)
[ERROR]     at Module._compile (/home/me/devel/my-app/node_modules/.pnpm/v8-compile-cache@2.0.3/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/v8-compile-cache@2.0.3/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/v8-compile-cache@2.0.3/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/v8-compile-cache@2.0.3/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/v8-compile-cache@2.0.3/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/workbox-webpack-plugin@6.1.0_webpack@4.46.0/node_modules/workbox-webpack-plugin/build/generate-sw.js',
[ERROR]     '/home/me/devel/my-app/node_modules/.pnpm/workbox-webpack-plugin@6.1.0_webpack@4.46.0/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/webpack-cli@3.3.11_webpack@4.46.0/node_modules/webpack-cli/bin/utils/convert-argv.js',
[ERROR]     '/home/me/devel/my-app/node_modules/.pnpm/webpack-cli@3.3.11_webpack@4.46.0/node_modules/webpack-cli/bin/cli.js',
[ERROR]     '/home/me/devel/my-app/node_modules/.pnpm/webpack@4.46.0_webpack-cli@3.3.11/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/webpack-cli@3.3.11_webpack@4.46.0/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/workbox-webpack-plugin@6.1.0_webpack@4.46.0/node_modules/workbox-webpack-plugin/build/generate-sw.js
[ERROR] - /home/me/devel/my-app/node_modules/.pnpm/workbox-webpack-plugin@6.1.0_webpack@4.46.0/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/webpack-cli@3.3.11_webpack@4.46.0/node_modules/webpack-cli/bin/utils/convert-argv.js
[ERROR] - /home/me/devel/my-app/node_modules/.pnpm/webpack-cli@3.3.11_webpack@4.46.0/node_modules/webpack-cli/bin/cli.js
[ERROR] - /home/me/devel/my-app/node_modules/.pnpm/webpack@4.46.0_webpack-cli@3.3.11/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/v8-compile-cache@2.0.3/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
[ERROR]     at Object.<anonymous> (/home/me/devel/my-app/node_modules/.pnpm/workbox-webpack-plugin@6.1.0_webpack@4.46.0/node_modules/workbox-webpack-plugin/build/generate-sw.js:20:33)
[ERROR]     at Module._compile (/home/me/devel/my-app/node_modules/.pnpm/v8-compile-cache@2.0.3/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/v8-compile-cache@2.0.3/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
[ERROR]     at Object.<anonymous> (/home/me/devel/my-app/node_modules/.pnpm/workbox-webpack-plugin@6.1.0_webpack@4.46.0/node_modules/workbox-webpack-plugin/build/index.js:10:20)
[ERROR]     at Module._compile (/home/me/devel/my-app/node_modules/.pnpm/v8-compile-cache@2.0.3/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/v8-compile-cache@2.0.3/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/v8-compile-cache@2.0.3/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/v8-compile-cache@2.0.3/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/v8-compile-cache@2.0.3/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/workbox-webpack-plugin@6.1.0_webpack@4.46.0/node_modules/workbox-webpack-plugin/build/generate-sw.js',
[ERROR]     '/home/me/devel/my-app/node_modules/.pnpm/workbox-webpack-plugin@6.1.0_webpack@4.46.0/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/webpack-cli@3.3.11_webpack@4.46.0/node_modules/webpack-cli/bin/utils/convert-argv.js',
[ERROR]     '/home/me/devel/my-app/node_modules/.pnpm/webpack-cli@3.3.11_webpack@4.46.0/node_modules/webpack-cli/bin/cli.js',
[ERROR]     '/home/me/devel/my-app/node_modules/.pnpm/webpack@4.46.0_webpack-cli@3.3.11/node_modules/webpack/bin/webpack.js'
[ERROR]   ]
[ERROR] }

在我的本地计算机 (macOs 11.4) 上,我安装了节点 v16.6.1,但它在我们未安装节点的 jenkins 服务器上也失败了。

最好的问候延斯

这是一个 webpack 问题,目前正在通过 https://github.com/vaadin/flow/pull/11527

解决

编辑:修复包含在最新的 Vaadin 20.0.6 release via Vaadin Flow 7.0.6.

可以确认无法通过切换到 v20.0.6 解决无法找到模块 'workbox-build/build/options/schema/webpack-generate-sw' 的问题,寻找替代解决方案。