Node.js error in Vaadin Spring Boot application
Trying to run Creating CRUD UI with Vaadin project in Intellij IDEA
thar contains following build.gradle
:
plugins {
id 'org.springframework.boot' version '2.3.2.RELEASE'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'java'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
maven { url "https://maven.vaadin.com/vaadin-addons" }
}
dependencyManagement {
imports {
mavenBom 'com.vaadin:vaadin-bom:14.3.9'
}
}
dependencies {
implementation 'com.vaadin:vaadin-spring-boot-starter'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
runtimeOnly 'com.h2database:h2'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
}
test {
useJUnitPlatform()
}
Got node problem while run project:
2020-10-07 19:01:42.637 INFO 8364 --- [ main] NodeInstaller : Installing node version v12.18.3
2020-10-07 19:01:42.637 INFO 8364 --- [ main] NodeInstaller : Downloading https://nodejs.org/dist/v12.18.3/node-v12.18.3-win-x64.zip to C:\Users\g\.vaadin\node-v12.18.3-win-x64.zip
2020-10-07 19:01:42.638 INFO 8364 --- [ main] ProxyConfig : No proxies configured
2020-10-07 19:01:42.638 INFO 8364 --- [ main] FileDownloader : No proxy was configured, downloading directly
2020-10-07 19:01:52.244 INFO 8364 --- [ main] NodeInstaller : Unpacking C:\Users\g\.vaadin\node-v12.18.3-win-x64.zip into C:\Users\g\.vaadin\node\tmp
2020-10-07 19:01:54.523 INFO 8364 --- [ main] NodeInstaller : Copying node binary from C:\Users\g\.vaadin\node\tmp\node-v12.18.3-win-x64\node.exe to C:\Users\g\.vaadin\node\node.exe
2020-10-07 19:01:54.524 INFO 8364 --- [ main] NodeInstaller : Extracting NPM
2020-10-07 19:02:21.733 INFO 8364 --- [ main] NodeInstaller : Local node installation successful.
C:\Users\g\.vaadin\node\node.exe: bad option: --no-update-notifier
C:\Users\g\.vaadin\node\node.exe: bad option: --no-audit
C:\Users\g\.vaadin\node\node.exe: bad option: --scripts-prepend-node-path=true
2020-10-07 19:02:22.336 ERROR 8364 --- [ main] dev-updater : Command `C:\Users\g\.vaadin\node\node.exe --no-update-notifier --no-audit --scripts-prepend-node-path=true install` failed:
2020-10-07 19:02:22.336 ERROR 8364 --- [ main] dev-updater : >>> Dependency ERROR. Check that all required dependencies are deployed in npm repositories.
2020-10-07 19:02:22.340 ERROR 8364 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Exception sending context initialized event to listener instance of class [com.vaadin.flow.spring.VaadinServletContextInitializer$DevModeServletContextListener]
java.lang.RuntimeException: Unable to initialize Vaadin DevModeHandler
How to solve this problem?
Solution 1:
The version of Node.js that comes with vaadin is the problem. Install the latest version of Node.js. Go to its installation directory copy node_modules folder and node.exe and replace those in C:\Users~.vaadin\node.