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?
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.