See both [problem and solution on Stack Overflow]
(https://stackoverflow.com/q/57502852/642706).
I used the Get Started page for “Vaadin 14 (Pre Release)”:
https://vaadin.com/start/pre-release
…with the “Plain Java Servlet” option. A new project was downloaded to my Mac (Mojave). I opened the project with IntelliJ Ultimate edition version 2019.2, and waiting a while for Maven to do its thing. Eventually in the Maven panel I ran the two Lifecycle items clean
and install
. That resulted in this error.
[ERROR]
Failed to execute goal com.vaadin:vaadin-maven-plugin:14.0.0.rc9:prepare-frontend (default) on project example: Execution default of goal com.vaadin:vaadin-maven-plugin:14.0.0.rc9:prepare-frontend failed:
[ERROR]
[ERROR]
======================================================================================================
[ERROR]
Failed to determine ‘node’ tool.
[ERROR]
Please install it either:
[ERROR]
- by following the https://nodejs.org/en/download/ guide to install it globally
[ERROR] - or by running the frontend-maven-plugin goal to install it in this project:
[ERROR]
$ mvn com.github.eirslett:frontend-maven-plugin:1.7.6:install-node-and-npm -DnodeVersion=“v10.16.0”
[ERROR]
======================================================================================================
[ERROR]
[ERROR]
→ [Help 1]
[ERROR]
[ERROR]
To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR]
Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR]
For more information about the errors and possible solutions, please read the following articles:
[ERROR]
[Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
I know virtually nothing about NodeJS & npm — and I don’t really want to know about them. That is why I use Vaadin, to avoid JavaScript.
I realize the problem has something to do with needing to install NodeJS and npm. I do not really want to do a global install and pollute my Mac with all those parts. So would prefer to install it only within my Vaadin project. That seems to be benefit to using that Maven-driven approach listed on lines 7 & 8.
But I don’t want to run Maven outside of my IDE and project. So I tried to install this frontend-maven-plugin
in my Vaadin project’s POM file. I copied from the frontend-maven-plugin
project page on GitHub.com:
https://github.com/eirslett/frontend-maven-plugin
In my POM, in the <build> <plugins>
element, I added another <plugin>
element at the end.
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<!-- Use the latest released version:
https://repo1.maven.org/maven2/com/github/eirslett/frontend-maven-plugin/ -->
<version>1.8.0</version>
<execution>
<!-- optional: you don't really need execution ids, but it looks nice in your build log. -->
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<!-- optional: default phase is "generate-resources" -->
<phase>generate-resources</phase>
</execution>
<configuration>
<nodeVersion>v10.16.2</nodeVersion>
<!-- optional: with node version greater than 4.0.0 will use npm provided by node distribution -->
<!-- <npmVersion>2.15.9</npmVersion>-->
<!-- optional: where to download node and npm from. Defaults to https://nodejs.org/dist/ -->
<!-- <downloadRoot>http://myproxy.example.org/nodejs/</downloadRoot>-->
</configuration>
</plugin>
But that results in an error reported on the <execution>
element:
[ERROR]
Some problems were encountered while processing the POMs:
Malformed POM /Users/basilbourque/IdeaProjects/example/pom.xml: Unrecognised tag: ‘execution’ (position: START_TAG seen …\n\n … @196:28)
Is there some way to get node and npm to be installed automatically by Maven?