gpt4 book ai didi

java - 检测到错误的 Node.js 版本

转载 作者:行者123 更新时间:2023-12-04 18:49:43 25 4
gpt4 key购买 nike

我正在尝试使用 Maven 结合使用 Spring 和 Angular 创建的项目
问题是使用 Node.js 版本时,

[ERROR] Node.js version v8.11.3 detected.
[ERROR] The Angular CLI requires a minimum Node.js version of either v10.13 or v12.0.
当我通过 node -v 检查版本时我有 v12.0.0.我正在使用 Ubuntu 16.04,我使用 nvm 来安装 Node.js
如何升级 Node.js 的版本?
我试过了:
  • 从 Ubuntu 中完全删除 link , 之后我仍然可以看到 node -v 的版本
  • 由 nvm link 升级
  • 来自stackoverflow的一堆解决方案:link link (不知道如何在Ubutnu办理入住)
  • 0 info it worked if it ends with ok
    1 verbose cli [ '/home/pawel/Pulpit/NoteItApp/noteIt-ng-app/src/main/web/node/node',
    1 verbose cli '/home/pawel/Pulpit/NoteItApp/noteIt-ng-app/src/main/web/node/node_modules/npm/bin/npm-cli.js',
    1 verbose cli 'run',
    1 verbose cli 'build' ]
    2 info using npm@6.3.0
    3 info using node@v8.11.3
    4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
    5 info lifecycle noteit-ng-app@0.0.0~prebuild: noteit-ng-app@0.0.0
    6 info lifecycle noteit-ng-app@0.0.0~build: noteit-ng-app@0.0.0
    7 verbose lifecycle noteit-ng-app@0.0.0~build: unsafe-perm in lifecycle true
    8 verbose lifecycle noteit-ng-app@0.0.0~build: PATH: /home/pawel/Pulpit/NoteItApp/noteIt-ng-app/src/main/web/node/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/pawel/Pulpit/NoteItApp/noteIt-ng-app/node_modules/.bin:/home/pawel/Pulpit/NoteItApp/noteIt-ng-app/src/main/web/node:/home/pawel/.nvm/versions/node/v12.0.0/bin:/opt/maven/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:
    9 verbose lifecycle noteit-ng-app@0.0.0~build: CWD: /home/pawel/Pulpit/NoteItApp/noteIt-ng-app
    10 silly lifecycle noteit-ng-app@0.0.0~build: Args: [ '-c', 'ng build' ]
    11 silly lifecycle noteit-ng-app@0.0.0~build: Returned: code: 3 signal: null
    12 info lifecycle noteit-ng-app@0.0.0~build: Failed to exec build script
    13 verbose stack Error: noteit-ng-app@0.0.0 build: `ng build`
    13 verbose stack Exit status 3
    13 verbose stack at EventEmitter.<anonymous> (/home/pawel/Pulpit/NoteItApp/noteIt-ng-app/src/main/web/node/node_modules/npm/node_modules/npm-lifecycle/index.js:304:16)
    13 verbose stack at emitTwo (events.js:126:13)
    13 verbose stack at EventEmitter.emit (events.js:214:7)
    13 verbose stack at ChildProcess.<anonymous> (/home/pawel/Pulpit/NoteItApp/noteIt-ng-app/src/main/web/node/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
    13 verbose stack at emitTwo (events.js:126:13)
    13 verbose stack at ChildProcess.emit (events.js:214:7)
    13 verbose stack at maybeClose (internal/child_process.js:925:16)
    13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
    14 verbose pkgid noteit-ng-app@0.0.0
    15 verbose cwd /home/pawel/Pulpit/NoteItApp/noteIt-ng-app/src/main/web
    16 verbose Linux 5.3.0-61-generic
    17 verbose argv "/home/pawel/Pulpit/NoteItApp/noteIt-ng-app/src/main/web/node/node" "/home/pawel/Pulpit/NoteItApp/noteIt-ng-app/src/main/web/node/node_modules/npm/bin/npm-cli.js" "run" "build"
    18 verbose node v8.11.3
    19 verbose npm v6.3.0
    20 error code ELIFECYCLE
    21 error errno 3
    22 error noteit-ng-app@0.0.0 build: `ng build`
    22 error Exit status 3
    23 error Failed at the noteit-ng-app@0.0.0 build script.
    23 error This is probably not a problem with npm. There is likely additional logging output above.
    24 verbose exit [ 3, true ]
    请指教。

    最佳答案

    在你的前端 pom 中,你使用 frontend-maven-plugin 来管理你的 Node 安装。这意味着它会安装自己的 Node 版本以用于构建。 Node 版本由 <nodeVersion>v8.11.3</nodeVersion> 指定.将版本更改为 v12.0.0

    关于java - 检测到错误的 Node.js 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62646391/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com