vaadin / flow

Vaadin Flow is a Java framework binding Vaadin web components to Java. This is part of Vaadin 10+.
Apache License 2.0
618 stars 167 forks source link

Flow frontend build fails when Npm 8.6.0 (or later) is used with Node 16.14.2 #13872

Closed mshabarov closed 2 years ago

mshabarov commented 2 years ago

Description of the bug

Flow 23 uses Node v16.15.0 and Npm 8.5.5 as a default versions installed automatically if too old or no versions are discovered on the machine. When Npm 8.6.0 or later is used, the frontend build ends with the following errors:

[ForkJoinPool.commonPool-worker-3] INFO dev-webpack - Running webpack to compile frontend resources. This may take a moment, please stand by...
[ForkJoinPool.commonPool-worker-3] ERROR dev-webpack - Webpack failed with the exception:
/usr/bin/node: --openssl-legacy-provider is not allowed in NODE_OPTIONS
[01:21:16]F:             [listener_should_stopDevModeHandler_onDestroy] java.lang.reflect.InvocationTargetException
[01:21:16]F:             [listener_should_stopDevModeHandler_onDestroy] java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.vaadin.flow.server.startup.DevModeInitializerTestBase.waitForDevModeServer(DevModeInitializerTestBase.java:200)
    at com.vaadin.flow.server.startup.DevModeInitializerTestBase.process(DevModeInitializerTestBase.java:186)
    at com.vaadin.flow.server.startup.DevModeInitializerTest.listener_should_stopDevModeHandler_onDestroy(DevModeInitializerTest.java:331)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.rules.ExpectedException$ExpectedExceptionStatement.evaluate(ExpectedException.java:258)
    at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
    at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
    at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
    at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
    at org.junit.runners.Suite.runChild(Suite.java:128)
    at org.junit.runners.Suite.runChild(Suite.java:27)
    at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
    at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
    at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
    at org.apache.maven.surefire.junitcore.JUnitCore.run(JUnitCore.java:55)
    at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.createRequestAndRun(JUnitCoreWrapper.java:137)
    at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.executeEager(JUnitCoreWrapper.java:107)
    at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:83)
    at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:75)
    at org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:158)
    at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)
    at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)
Caused by: java.util.concurrent.CompletionException: java.lang.IllegalStateException: Webpack exited prematurely
    at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:292)
    at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:308)
    at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:769)
    at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:736)
    at java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:443)
    at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
    at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
    at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
    at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Caused by: java.lang.IllegalStateException: Webpack exited prematurely
    at com.vaadin.flow.server.DevModeHandler.doStartWebpack(DevModeHandler.java:700)
    at com.vaadin.flow.server.DevModeHandler.doStartDevModeServer(DevModeHandler.java:617)
    at com.vaadin.flow.server.DevModeHandler.runOnFutureComplete(DevModeHandler.java:564)
    at com.vaadin.flow.server.DevModeHandler.lambda$new$0(DevModeHandler.java:161)
    at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:760)
    ... 6 more

Sometimes it fails with another error:

[11:20:34] :     [Step 5/6] [INFO] --- exec-maven-plugin:3.0.0:exec (run-tests) @ flow-client ---
[11:20:34] :     [Step 5/6] 
[11:20:34] :     [Step 5/6] > @vaadin/flow-deps@0.0.1 test
[11:20:34] :     [Step 5/6] > npm run build && npm run webpack && intern
[11:20:34] :     [Step 5/6] 
[11:20:34] :     [Step 5/6] 
[11:20:34] :     [Step 5/6] > @vaadin/flow-deps@0.0.1 build
[11:20:34] :     [Step 5/6] > npm run client && tsc
[11:20:34] :     [Step 5/6] 
[11:20:35] :     [Step 5/6] 
[11:20:35] :     [Step 5/6] > @vaadin/flow-deps@0.0.1 client
[11:20:35] :     [Step 5/6] > node scripts/client.js
[11:20:35] :     [Step 5/6] 
[11:20:37] :     [Step 5/6] 
[11:20:37] :     [Step 5/6] > @vaadin/flow-deps@0.0.1 webpack
[11:20:37] :     [Step 5/6] > webpack --config=webpack.tests.config.js
[11:20:37] :     [Step 5/6] 
[11:20:38]W:         [com.vaadin:flow-client] node:internal/crypto/hash:67
[11:20:38]W:         [com.vaadin:flow-client]   this[kHandle] = new _Hash(algorithm, xofLen);
[11:20:38]W:         [com.vaadin:flow-client]                   ^
[11:20:38]W:         [com.vaadin:flow-client] 
[11:20:38]W:         [com.vaadin:flow-client] Error: error:0308010C:digital envelope routines::unsupported
[11:20:38]W:         [com.vaadin:flow-client]     at new Hash (node:internal/crypto/hash:67:19)
[11:20:38]W:         [com.vaadin:flow-client]     at Object.createHash (node:crypto:130:10)
[11:20:38]W:         [com.vaadin:flow-client]     at module.exports (/opt/agent/work/1e3f75bb7ff3ed55/flow-client/node_modules/webpack/lib/util/createHash.js:135:53)
[11:20:38]W:         [com.vaadin:flow-client]     at NormalModule._initBuildHash (/opt/agent/work/1e3f75bb7ff3ed55/flow-client/node_modules/webpack/lib/NormalModule.js:417:16)
[11:20:38]W:         [com.vaadin:flow-client]     at handleParseError (/opt/agent/work/1e3f75bb7ff3ed55/flow-client/node_modules/webpack/lib/NormalModule.js:471:10)
[11:20:38]W:         [com.vaadin:flow-client]     at /opt/agent/work/1e3f75bb7ff3ed55/flow-client/node_modules/webpack/lib/NormalModule.js:503:5
[11:20:38]W:         [com.vaadin:flow-client]     at /opt/agent/work/1e3f75bb7ff3ed55/flow-client/node_modules/webpack/lib/NormalModule.js:358:12
[11:20:38]W:         [com.vaadin:flow-client]     at /opt/agent/work/1e3f75bb7ff3ed55/flow-client/node_modules/loader-runner/lib/LoaderRunner.js:373:3
[11:20:38]W:         [com.vaadin:flow-client]     at iterateNormalLoaders (/opt/agent/work/1e3f75bb7ff3ed55/flow-client/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
[11:20:38]W:         [com.vaadin:flow-client]     at Array.<anonymous> (/opt/agent/work/1e3f75bb7ff3ed55/flow-client/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
[11:20:38]W:         [com.vaadin:flow-client]     at Storage.finished (/opt/agent/work/1e3f75bb7ff3ed55/flow-client/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
[11:20:38]W:         [com.vaadin:flow-client]     at /opt/agent/work/1e3f75bb7ff3ed55/flow-client/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
[11:20:38]W:         [com.vaadin:flow-client]     at /opt/agent/work/1e3f75bb7ff3ed55/flow-client/node_modules/graceful-fs/graceful-fs.js:123:16
[11:20:38]W:         [com.vaadin:flow-client]     at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) {
[11:20:38]W:         [com.vaadin:flow-client]   opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
[11:20:38]W:         [com.vaadin:flow-client]   library: 'digital envelope routines',
[11:20:38]W:         [com.vaadin:flow-client]   reason: 'unsupported',
[11:20:38]W:         [com.vaadin:flow-client]   code: 'ERR_OSSL_EVP_UNSUPPORTED'
[11:20:38]W:         [com.vaadin:flow-client] }
[11:20:38]W:     [Step 5/6] [ERROR] Command execution failed.
[11:20:38] :     [Step 5/6] org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
[11:20:38] :     [Step 5/6]     at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:404)
[11:20:38] :     [Step 5/6]     at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166)
[11:20:38] :     [Step 5/6]     at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:982)
[11:20:38] :     [Step 5/6]     at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:929)
[11:20:38] :     [Step 5/6]     at org.codehaus.mojo.exec.ExecMojo.execute (ExecMojo.java:457)
[11:20:38] :     [Step 5/6]     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
[11:20:38] :     [Step 5/6]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
[11:20:38] :     [Step 5/6]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
[11:20:38] :     [Step 5/6]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
[11:20:38] :     [Step 5/6]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
[11:20:38] :     [Step 5/6]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
[11:20:38] :     [Step 5/6]     at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
[11:20:38] :     [Step 5/6]     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
[11:20:38] :     [Step 5/6]     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
[11:20:38] :     [Step 5/6]     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
[11:20:38] :     [Step 5/6]     at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
[11:20:38] :     [Step 5/6]     at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954)
[11:20:38] :     [Step 5/6]     at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
[11:20:38] :     [Step 5/6]     at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
[11:20:38] :     [Step 5/6]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
[11:20:38] :     [Step 5/6]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
[11:20:38] :     [Step 5/6]     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
[11:20:38] :     [Step 5/6]     at java.lang.reflect.Method.invoke (Method.java:566)
[11:20:38] :     [Step 5/6]     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
[11:20:38] :     [Step 5/6]     at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
[11:20:38] :     [Step 5/6]     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
[11:20:38] :     [Step 5/6]     at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[11:20:38] :     [Step 5/6] [Maven Watcher] 
[11:20:38]E:     [Step 5/6] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:exec (run-tests) on project flow-client: Command execution failed.

The first is a problem saying you are providing the option but should not. The second is a problem saying you are not providing the option but need to.

Expected behavior

Vaadin 23 application starts fine with npm 8.6.0+

Minimal reproducible example

  1. Install Node 16.14.2 and Npm 8.6.0 globally.
  2. Download starter project from start.vaadin.com.
  3. Start the project by mvn.

Versions

mshabarov commented 2 years ago

Closed in favour of https://github.com/vaadin/flow/issues/13889, because the root cause is the same.