Node.js在Vaadin Spring Boot应用中的错误

huangapple go评论76阅读模式
英文:

Node.js error in Vaadin Spring Boot application

问题

尝试在Intellij IDEA中运行包含以下build.gradle使用Vaadin创建CRUD UI项目

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()
}

在运行项目时遇到了节点问题:

2020-10-07 19:01:42.637  INFO 8364 --- [           main] NodeInstaller                            : Installing node version v12.18.3
...
C:\Users\g\.vaadin\node\node.exe: bad option: --no-update-notifier
...
java.lang.RuntimeException: Unable to initialize Vaadin DevModeHandler

如何解决这个问题?

英文:

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?

答案1

得分: 3

Node.js的版本是vaadin附带的问题。安装最新版本的Node.js。转到其安装目录,复制node_modules文件夹和node.exe文件,然后将它们替换到C:\Users~.vaadin\node中。

英文:

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.

答案2

得分: 0

以下是已经翻译好的内容:

对我有帮助的是:

  1. 安装 npm,
  2. 将路径添加到 PATH,
  3. 重新启动控制台/集成开发环境。
英文:

For me was help:

  1. install npm,
  2. add path to PATH
  3. restart console/ide.

huangapple
  • 本文由 发表于 2020年10月8日 00:43:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/64248583.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定