java - Vaadin Spring Boot 应用程序中的 Node.js 错误

标签 java node.js spring-boot vaadin

尝试运行Creating CRUD UI with Vaadin projectIntellij IDEA 中包含以下 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()
}

运行项目时遇到 Node 问题:

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

如何解决这个问题?

最佳答案

vaadin 自带的 Node.js 版本有问题。安装最新版本的 Node.js。进入其安装目录复制node_modules文件夹和node.exe并替换C:\Users~.vaadin\node中的内容。

关于java - Vaadin Spring Boot 应用程序中的 Node.js 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64248583/

相关文章:

node.js - 使用 NodeJs Mongo 和 Express 保留更新时的哈希密码

java.lang.IllegalArgumentException : The region 'eu-west-2' is not a valid region

javascript - 使用 iText 在 pdf 的某些位置上进行 Java Stamp

java - log4j 到 log4j2 自定义 RollingPolicy

javascript - 类型 'Server' 上不存在属性 'typeof "http"'

javascript - sql语法错误mysql Node js?

java - 在 Spring Boot Controller 中使用 GraphQL API

java - 在 spring data elasticsearch 中保存 ENUM

java - 检查对象是否为空的最快方法

java - JScrollPane 中的 JTable 在滚动时不会自动重绘