question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Vaadin 23 Dev Mode + Payara -> NPM Dependency Error

See original GitHub issue

Description of the bug

Deploying a simple Vaadin application in dev mode to Payara Server 5.2022.2 causes NPM Dependency ERROR. Deploying the same application to Tomcat works fine. Deploying the same application in production mode works with both servers.

Expected behavior

Dev Mode should be available with Vaadin 23 and Payara.

Minimal reproducible example

Preparation

  1. generate default app start.vaadin.com
  2. publish to github (https://github.com/skiedrowski/vaadinDevModeTrouble)
  3. modify for war deployment (https://vaadin.com/blog/packaging-and-deploying-spring-boot-applications-as-war-files)
  4. push to github

Tomcat works

  1. clone repo https://github.com/skiedrowski/vaadinDevModeTrouble into vaadinDevModeTroubleTomcat
  2. run ./mvnw package
  3. Download and extract Tomcat 9.0.62 into project
  4. start Tomcat (cd apache-tomcat-9.0.62/bin/ && ./startup.sh)
  5. Deploy to Tomcat (cd ../.. && cp target/myapp.war apache-tomcat-9.0.62/webapps/)
  6. open http://localhost:8080/myapp/ –> works fine
  7. shutdown apache-tomcat-9.0.62/bin/shutdown.sh

Payara fails

  1. clone repo https://github.com/skiedrowski/vaadinDevModeTrouble into vaadinDevModeTroublePayara
  2. run ./mvnw package
  3. Download and extract Payara 5.2022.2 into project
  4. start Payara (payara5/bin/asadmin start-domain)
  5. Deploy to Payara (payara5/bin/asadmin deploy target/myapp.war)
  6. open http://localhost:8080/myapp/

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Fri Apr 29 08:01:53 CEST 2022 There was an unexpected error (type=Internal Server Error, status=500).

payara5/glassfish/domains/domain1/logs/server.log contains

[2022-04-29T08:49:45.257+0200] [Payara 5.2022.2] [INFORMATION] [] [] [tid: _ThreadID=101 _ThreadName=ForkJoinPool.commonPool-worker-19] [timeMillis: 1651214985257] [levelValue: 800] [[
  2022-04-29 08:49:45.257 ERROR 48064 --- [nPool-worker-19] c.v.f.s.frontend.TaskUpdatePackages      : Command `/Users/sascha/.vaadin/node/node /Users/sascha/.vaadin/node/node_modules/npm/bin/npm-cli.js --no-update-notifier --no-audit --scripts-prepend-node-path=true --ignore-scripts install` failed:

]]

[2022-04-29T08:49:45.257+0200] [Payara 5.2022.2] [INFORMATION] [] [] [tid: _ThreadID=101 _ThreadName=ForkJoinPool.commonPool-worker-19] [timeMillis: 1651214985257] [levelValue: 800] [[
  2022-04-29 08:49:45.257 ERROR 48064 --- [nPool-worker-19] c.v.f.s.frontend.TaskUpdatePackages      : >>> Dependency ERROR. Check that all required dependencies are deployed in npm repositories.
]]

[2022-04-29T08:49:55.254+0200] [Payara 5.2022.2] [INFORMATION] [] [] [tid: _ThreadID=112 _ThreadName=http-thread-pool::http-listener-1(5)] [timeMillis: 1651214995254] [levelValue: 800] [[
  2022-04-29 08:49:55.254 ERROR 48064 --- [p-listener-1(5)] c.v.flow.server.DefaultErrorHandler      : 

java.lang.IllegalStateException: com.vaadin.flow.server.ExecutionFailedException: Npm install has exited with non zero status. Some dependencies are not installed. Check npm command output
	at com.vaadin.base.devserver.AbstractDevServerRunner.getCause(AbstractDevServerRunner.java:769) ~[vaadin-dev-server-23.0.5.jar:na]
	at com.vaadin.base.devserver.AbstractDevServerRunner.getCause(AbstractDevServerRunner.java:765) ~[vaadin-dev-server-23.0.5.jar:na]
	at com.vaadin.base.devserver.AbstractDevServerRunner.handleRequest(AbstractDevServerRunner.java:631) ~[vaadin-dev-server-23.0.5.jar:na]
	at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1567) ~[flow-server-23.0.5.jar:23.0.5]
	at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:299) ~[flow-server-23.0.5.jar:23.0.5]
...
Caused by: com.vaadin.flow.server.ExecutionFailedException: Npm install has exited with non zero status. Some dependencies are not installed. Check npm command output
...

~/.npm/_logs/2022-04-29T06_49_42_618Z-debug-0.log contains

272 warn deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
273 timing reifyNode:node_modules/source-map-url Completed in 1755ms
274 verbose stack Error: write EPIPE
274 verbose stack     at afterWriteDispatched (node:internal/stream_base_commons:160:15)
274 verbose stack     at writeGeneric (node:internal/stream_base_commons:151:3)
274 verbose stack     at Socket._writeGeneric (node:net:795:11)
274 verbose stack     at Socket._write (node:net:807:8)
274 verbose stack     at writeOrBuffer (node:internal/streams/writable:389:12)
274 verbose stack     at _write (node:internal/streams/writable:330:10)
274 verbose stack     at Socket.Writable.write (node:internal/streams/writable:334:10)
274 verbose stack     at EventEmitter.log.write (/Users/sascha/.vaadin/node/node_modules/npm/node_modules/npmlog/lib/log.js:362:10)
274 verbose stack     at EventEmitter.<anonymous> (/Users/sascha/.vaadin/node/node_modules/npm/node_modules/npmlog/lib/log.js:297:12)
274 verbose stack     at Array.forEach (<anonymous>)
275 verbose cwd /Users/sascha/zitecs/src/com.zitecs/ologis/core/vaadinDevModeTroublePayara
276 verbose Darwin 21.4.0
277 verbose argv "/Users/sascha/.vaadin/node/node" "/Users/sascha/.vaadin/node/node_modules/npm/bin/npm-cli.js" "--no-update-notifier" "--no-audit" "--scripts-prepend-node-path=true" "--ignore-scripts" "install"
278 verbose node v16.14.2
279 verbose npm  v8.5.0
280 error code EPIPE
281 error syscall write
282 error errno -32
283 error write EPIPE
284 verbose exit -32
  1. shutdown payara5/bin/asadmin stop-domain

Versions

  • Vaadin / Flow version: reproduced with 23.0.5 and 23.0.7
  • Java version: 11.0.14, 11.0.11
  • OS version: macOS 12.3.1, macOS 10.15.5
  • Hardware: MacBook Pro M1 Max, MacBook Pro Intel i9
  • Browser version: Safari 15.4 and Chrome 101.0.4951.41
  • Application Server: reproduced with Payara Server (Full) 5.2022.2 and Payara Server (Full) 5.2020.6
  • IDE (if applicable): not relevant (IntelliJ IDEA 2022.1 Ultimate)

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mcollovaticommented, Apr 29, 2022

It seems like the problem is related to how STDERR is handled by processes launched by the JVM. If in TaskRunNpmInstall.runNpmCommand() I change builder.redirectError(ProcessBuilder.Redirect.INHERIT) to builder.redirectError(ProcessBuilder.Redirect.PIPE), npm execution completes successfully. For vertx-maven-plugin, I think the problem is how the parent process, created by the maven plugin, handles STDERR redirection.

0reactions
mcollovaticommented, May 1, 2022

Additional fact is that error seems to happen only with WebpackHandler; with Vite enabled, all works fine in Payara.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error "Failed to determine 'node' tool." with new Vaadin 14.0.0 ...
I realize the problem has something to do with needing to install NodeJS and npm. ... <artifactId>flow-server-production-mode</artifactId> </dependency> ...
Read more >
triple UI loaded on Vaadin - spring boot - Stack Overflow
I am trying to build a (war) project with Vaadin (23) + Spring boot (2.7+) on Payara (5.2), after a lot of configurations...
Read more >
dplatz.de - notes of a java developer
The problem usually is related to the usage of two different Java compilers in your workflow. Say, you are building and deploying your...
Read more >
Maven Configuration Issue error | Selenium Forum
Hi Ashish,. I tried in Eclipse Luna for the Live Project. Attached word for your reference also the command prompt details below.
Read more >
Vaadin Bower Components Module Not Found - ADocLib
I have a maven project with `vaadin 14.1.25` and `Java EE 7` which creates a `.war file`. 1.1.14 Webjars are only needed when...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found