1

Update:

The problem occurs only when running in Tomcat from IntelliJ after having doing a Maven clean without doing a Maven install.

If I do a Maven Install before running my external Tomcat Run/Debug Configuration, then the web app launches properly.

So the core problem seems to be that the "Build" stage listed on the Deployment tab of that Run/Debug Configuration is not actually building.

How to get my Run/Debug Configuration settings to actually build the project, so I do not have to remember to manually hit the Maven > Lifecycle > install item each time?

screenshot of IntelliJ 2019 > Run/Debug Configuration > Deployment tab


As described in this Answer, I added an entry in my Vaadin 14.0.5 web-app’s Maven POM to install the dependency for Node.js 10.6.3 that comes bundled with the npm tool needed by Vaadin.

This works when using the Jetty server specified in that same POM file. I see the logs installing Node/npm on first run. I see the logs checking for Node/npm, and finding it already installed, on subsequent runs. My Vaadin web-app runs successfully when executing from the Maven panel within IntelliJ Ultimate 2019.2.3 via Plugins > jetty > jetty:run.

When I switch to a runtime configuration using Tomcat 9.0.26 locally, I get an error saying Vaadin cannot find the npm tool.

Earlier in the console output I see a positive message about connecting to server.

Connected to server

[2019-09-29 07:27:09,276] Artifact plainandsimple:war exploded: Artifact is being deployed, please wait...

But later I get this error message:

29-Sep-2019 19:27:11.758 SEVERE [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal Error during ServletContainerInitializer processing
    javax.servlet.ServletException: com.vaadin.flow.server.ExecutionFailedException: 

======================================================================================================
Failed to determine 'npm' tool.
Please install it either:
  - by following the https://nodejs.org/en/download/ guide to install it globally
  - or by running the frontend-maven-plugin goal to install it in this project:
  $ mvn com.github.eirslett:frontend-maven-plugin:1.7.6:install-node-and-npm -DnodeVersion="v10.16.0" 
======================================================================================================

That second option (frontend-maven-plugin) is exactly what I had set up successfully as described above at the top of this Question.

➥ Why does this work with Jetty but not with Tomcat?

➥ Can I make a bundled Node.js/npm work with Tomcat?

I am trying to avoid installing Node.js globally on my Mac.

If I manually move the WAR file to Tomcat, and launch Tomcat manually, the Vaadin web-app runs successfully.

Community
  • 1
  • 1
Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
  • I get this too sometimes, with a completely different setup. I use `liberty:run-server` to run locally, and I have npm and node installed globally on my machine. This occurs very inconsistently and when I install and run again, it works again. – kscherrer Sep 30 '19 at 06:41
  • @KasparScherrer I’m not sure, still experimenting, but it seems if I do a Maven `clean` so there is no prebuilt WAR, then running in Tomcat from within IntelliJ results in this “Failed to determine npm” error. If I do a Maven `install` that results in a built WAR, then I do not get that error (I get very different problems) when running in Tomcat from within IntelliJ. I wonder if this might account for your intermittent error. – Basil Bourque Sep 30 '19 at 07:02

0 Answers0