ng构建失败,并显示“您正在运行Node.js v8.11.3版本,Angular CLI 8.0+不支持该版本。”

时间:2019-10-18 18:39:28

标签: node.js npm angular-cli

我试图重现spring / angular [tutorial] [1],但是我无法运行ng build命令(由maven执行)。我多次重新安装了nodejs msi安装程序,但仍然显示不支持我的节点版本。我刚开始接触棱角,不知道该怎么做。我发现很多相关问题都可以通过npm cache clean和npm update来解决,但是并不能解决我的问题

Windows 10(64位)

me> npm -v
6.9.0

me>node -v
v10.16.3



[INFO] > ng build
[INFO]
[ERROR] You are running version v8.11.3 of Node.js, which is not supported by Angular CLI 8.0+.
[ERROR] The official Node.js version that is supported is 10.9 or greater.
[ERROR]
[ERROR] Please visit https://nodejs.org/en/ to find instructions on how to update Node.js.
[ERROR] npm ERR! code ELIFECYCLE
[ERROR] npm ERR! errno 3
[ERROR] npm ERR! frontend@0.0.0 build: `ng build`
[ERROR] npm ERR! Exit status 3
[ERROR] npm ERR!
[ERROR] npm ERR! Failed at the frontend@0.0.0 build script.
[ERROR] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[ERROR]
[ERROR] npm ERR! A complete log of this run can be found in:
[ERROR] npm ERR!     C:\Users\example\AppData\Roaming\npm-cache\_logs\2019-10-18T18_24_53_469Z-debug.log
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] example 1.0-SNAPSHOT    ............................ SUCCESS [  0.384 s]
[INFO] frontend ........................................... FAILURE [ 13.778 s]
[INFO] backend 1.0-SNAPSHOT ............................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.609 s
[INFO] Finished at: 2019-10-18T20:24:53+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.3:npm (npm run build) on project frontend: Failed to run task: 'npm run bu
ild' failed. (error code 3) -> [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/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :frontend


  [1]: https://dzone.com/articles/building-a-web-app-using-spring-boot-angular-6-and

1 个答案:

答案 0 :(得分:1)

您正在使用maven-fronted-plugin安装并执行node / npm的本地分发,而不是全局安装的常规二进制文件。 有关maven pom.xml文件中所需节点版本的配置,请参见https://github.com/eirslett/frontend-maven-plugin