Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular Maven构建失败_Angular_Typescript_Maven_Frontend Maven Plugin - Fatal编程技术网

Angular Maven构建失败

Angular Maven构建失败,angular,typescript,maven,frontend-maven-plugin,Angular,Typescript,Maven,Frontend Maven Plugin,我正在尝试部署angular和spring引导应用程序,但在执行mvn clean compile spring boot:run时遇到问题,我的angular pom不断出现构建失败 这就是错误所说的 C:\work\projects\todo>mvn clean compile -e [INFO] Error stacktraces are turned on. [INFO] Scanning for projects... [INFO] -----------------------

我正在尝试部署angular和spring引导应用程序,但在执行
mvn clean compile spring boot:run
时遇到问题,我的angular pom不断出现构建失败

这就是错误所说的

C:\work\projects\todo>mvn clean compile -e
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] todolist-parent                                                    [pom]
[INFO] todolist-web                                                       [jar]
[INFO] todo                                                               [jar]
[INFO]
[INFO] --------------------< za.co.dotze:todolist-parent >---------------------
[INFO] Building todolist-parent 0.0.1-SNAPSHOT                            [1/3]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ todolist-parent ---
[INFO]
[INFO] ----------------------< za.co.dotze:todolist-web >----------------------
[INFO] Building todolist-web 0.0.1-SNAPSHOT                               [2/3]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ todolist-web ---
[INFO]
[INFO] --- frontend-maven-plugin:1.3:install-node-and-npm (install node and npm) @ todolist-web ---
[INFO] Node v8.11.3 is already installed.
[INFO] NPM 6.3.0 is already installed.
[INFO]
[INFO] --- frontend-maven-plugin:1.3:npm (npm install) @ todolist-web ---
[INFO] Running 'npm install' in C:\work\projects\todo\todolist-web\src\main\web
[WARNING] npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\fsevents):
[INFO] audited 5224 packages in 11.907s
[WARNING] npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
[INFO] found 167 vulnerabilities (59 low, 82 moderate, 24 high, 2 critical)
[ERROR]
[INFO]   run `npm audit fix` to fix them, or `npm audit` for details
[INFO]
[INFO] --- frontend-maven-plugin:1.3:npm (npm run build) @ todolist-web ---
[INFO] Running 'npm run build' in C:\work\projects\todo\todolist-web\src\main\web
[INFO]
[INFO] > angular-frontend@0.0.0 build C:\work\projects\todo\todolist-web
[INFO] > ng build
[INFO]
[INFO] Hash: 25ac2da00084d4ff945e
[INFO] Time: 9328ms
[INFO] chunk    {0} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 191 kB {4} [initial] [rendered]
[INFO] chunk    {1} main.bundle.js, main.bundle.js.map (main) 12.4 kB {3} [initial] [rendered]
[INFO] chunk    {2} styles.bundle.js, styles.bundle.js.map (styles) 13.5 kB {4} [initial] [rendered]
[INFO] chunk    {3} vendor.bundle.js, vendor.bundle.js.map (vendor) 2.21 MB [initial] [rendered]
[INFO] chunk    {4} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered]
[INFO]
[INFO] ERROR in C:/work/projects/todo/todolist-web/src/main/web/node/node_modules/npm/node_modules/smart-buffer/typings/utils.d.ts (2,29): File 'C:/work/projects/todo/todolist-web/src/main/web/node/node_modules/npm/node_modules/smart-buffer/typings/smartbuffer.d.ts
' is not a module.
[ERROR] npm ERR! code ELIFECYCLE
[ERROR] npm ERR! errno 1
[ERROR] npm ERR! angular-frontend@0.0.0 build: `ng build`
[ERROR] npm ERR! Exit status 1
[ERROR] npm ERR!
[ERROR] npm ERR! Failed at the angular-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\chris\AppData\Roaming\npm-cache\_logs\2019-02-18T20_40_52_622Z-debug.log
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for todolist-parent 0.0.1-SNAPSHOT:
[INFO]
[INFO] todolist-parent .................................... SUCCESS [  0.921 s]
[INFO] todolist-web ....................................... FAILURE [ 32.761 s]
[INFO] todo ............................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  34.336 s
[INFO] Finished at: 2019-02-18T22:40:56+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.3:npm (npm run build) on project todolist-web: Failed to run task: 'npm run build' failed. (error code 1) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.3:npm (npm run build) on project todolist-web: Failed to run task
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:497)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoFailureException: Failed to run task
    at com.github.eirslett.maven.plugins.frontend.mojo.AbstractFrontendMojo.execute (AbstractFrontendMojo.java:95)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:497)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: com.github.eirslett.maven.plugins.frontend.lib.TaskRunnerException: 'npm run build' failed. (error code 1)
    at com.github.eirslett.maven.plugins.frontend.lib.NodeTaskExecutor.execute (NodeTaskExecutor.java:60)
    at com.github.eirslett.maven.plugins.frontend.mojo.NpmMojo.execute (NpmMojo.java:62)
    at com.github.eirslett.maven.plugins.frontend.mojo.AbstractFrontendMojo.execute (AbstractFrontendMojo.java:89)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:497)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[ERROR]
[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 :todolist-web
但我不知道如何解决这个问题,甚至不知道它意味着什么,因为我注意到它产生了。我该怎么做才能修好它

这是我的pom

母体聚甲醛

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>za.co.dotze</groupId>
<artifactId>todolist-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.4.RELEASE</version>
    <relativePath/>
</parent>
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <skip>true</skip>
            </configuration>
        </plugin>
    </plugins>
</build>
<modules>
    <module>todolist-server</module>
    <module>todolist-web</module>
</modules>

4.0.0
扎克多泽
托多利斯特父母
0.0.1-快照
聚甲醛
org.springframework.boot
spring启动程序父级
2.0.4.1发布
org.springframework.boot
springbootmaven插件
真的
todolist服务器
托多利斯特网

todolist服务器pom

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
    <groupId>za.co.dotze</groupId>
    <artifactId>todolist-parent</artifactId>
    <version>0.0.1-SNAPSHOT</version>
</parent>

<groupId>za.co.dotze</groupId>
<artifactId>todolist-server</artifactId>
<version>0.0.1-SNAPSHOT</version>

<name>todo</name>
<description>Demo ToDo list project for OpenVantage</description>

<properties>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>za.co.dotze</groupId>
        <artifactId>todolist-web</artifactId>
        <version>${project.version}</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-rest</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.liquibase</groupId>
        <artifactId>liquibase-core</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.8.1</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <configuration>
                <packagingExcludes>WEB-INF/lib/tomcat-*.jar</packagingExcludes>
                <warName>todolist-app</warName>
            </configuration>

        </plugin>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <skip>true</skip>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <executions>
                <execution>
                    <id>copy-resources</id>
                    <phase>validate</phase>
                    <goals>
                        <goal>copy-resources</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${project.build.directory}/classes/resources/</outputDirectory>
                        <resources>
                            <resource>
                                <directory>${project.parent.basedir}/todolist-web/src/main/web/dist/np-app/</directory>
                            </resource>
                        </resources>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>

</build>

4.0.0
扎克多泽
托多利斯特父母
0.0.1-快照
扎克多泽
todolist服务器
0.0.1-快照
待办事项
OpenVantage的演示待办事项列表项目
1.8
扎克多泽
托多利斯特网
${project.version}
运行时
org.springframework.boot
spring引导启动器数据jpa
org.springframework.boot
弹簧启动启动器数据rest
org.springframework.boot
弹簧启动安全
org.springframework.boot
SpringBootStarterWeb
org.liquibase
液化酶核心
org.springframework.boot
弹簧靴开发工具
运行时
com.h2数据库
氢
运行时
mysql
mysql连接器java
运行时
org.springframework.boot
弹簧起动试验
测试
org.springframework.security
弹簧安全性试验
测试
朱尼特
朱尼特
4.12
测试
org.apache.commons
commons-lang3
3.8.1
org.apache.maven.plugins
maven surefire插件
org.apache.maven.plugins
maven战争插件
WEB-INF/lib/tomcat-*.jar
todolist应用程序
org.springframework.boot
springbootmaven插件
真的
maven资源插件
复制资源
验证
复制资源
${project.build.directory}/classes/resources/
${project.parent.basedir}/todolist-web/src/main/web/dist/np-app/

最后是我的todolist网络pom

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>za.co.dotze</groupId>
    <artifactId>todolist-parent</artifactId>
    <version>0.0.1-SNAPSHOT</version>
  </parent>

  <groupId>za.co.dotze</groupId>
  <artifactId>todolist-web</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <build>
   <plugins>
  <plugin>
    <groupId>com.github.eirslett</groupId>
    <artifactId>frontend-maven-plugin</artifactId>
    <version>1.3</version>
    <configuration>
      <nodeVersion>v8.11.3</nodeVersion>
      <npmVersion>6.3.0</npmVersion>
      <workingDirectory>src/main/web/</workingDirectory>
    </configuration>
    <executions>
      <execution>
        <id>install node and npm</id>
        <goals>
          <goal>install-node-and-npm</goal>
        </goals>
      </execution>
      <execution>
        <id>npm install</id>
        <goals>
          <goal>npm</goal>
        </goals>
      </execution>
      <execution>
        <id>npm run build</id>
        <goals>
          <goal>npm</goal>
        </goals>
        <configuration>
          <arguments>run build</arguments>
        </configuration>
      </execution>
      <execution>
        <id>prod</id>
        <goals>
          <goal>npm</goal>
        </goals>
        <configuration>
          <arguments>run-script build</arguments>
        </configuration>
        <phase>generate-resources</phase>
      </execution>
    </executions>
  </plugin>
</plugins>

4.0.0
扎克多泽
托多利斯特父母
0.0.1-快照
扎克多泽
托多利斯特网
0.0.1-快照
com.github.eirslett
前端maven插件
1.3
v8.11.3
6.3.0
src/main/web/
安装节点和npm
安装节点和npm
npm安装
npm
npm运行构建
npm
运行构建
戳
npm
运行脚本生成
产生资源

在仔细研究之后,我发现了这个问题。我们需要从
tsconfig.json
中忽略/排除
节点
文件夹,它是由
com.github.eirslett
前端maven插件
在构建过程中创建的。Typescript正在编译中包含节点文件夹的内容

尝试以下代码段-

{
    "compilerOptions": {
        "module": "system",
        "noImplicitAny": true,
        "removeComments": true,
        "preserveConstEnums": true,
        "outFile": "../../built/local/tsc.js",
        "sourceMap": true
    },
    "include": [
        "src/**/*"
    ],
    "exclude": [
        "node_modules",
        "**/*.spec.ts",
        "node"
    ]
}

经过反复研究,我发现了问题所在。我们需要从
tsconfig.json
中忽略/排除
节点
文件夹,它是由
com.github.eirslett
前端maven插件
在构建过程中创建的。Typescript正在编译中包含节点文件夹的内容

尝试以下代码段-

{
    "compilerOptions": {
        "module": "system",
        "noImplicitAny": true,
        "removeComments": true,
        "preserveConstEnums": true,
        "outFile": "../../built/local/tsc.js",
        "sourceMap": true
    },
    "include": [
        "src/**/*"
    ],
    "exclude": [
        "node_modules",
        "**/*.spec.ts",
        "node"
    ]
}

你找到这个问题的解决方案了吗?你找到这个问题的解决方案了吗?