angular - 如何使用 maven-exec-plugin 进行 npm clean?

标签 angular npm pom.xml node-modules maven-exec-plugin

我正在使用 exec-maven-plugin。我有 npm install 和 npm clean 的扩展。下面是我的 pom 文件中的插件部分。它包含 npm install 、 tsc run 和 npm clean 的扩展。

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.6.0</version>
    <executions>

      <execution>
        <id>npm run clean (clean)</id>
        <goals>
          <goal>exec</goal>
        </goals>
        <phase>clean</phase>
        <configuration>
          <workingDirectory>./src/</workingDirectory>
          <executable>npm</executable>
          <arguments>
            <argument>clean</argument>
          </arguments>
        </configuration>
      </execution>

    </executions>
  </plugin>

但是当我执行 maven-package 时,它​​会出现以下错误:

Usage: npm <command>

where <command> is one of:
    access, adduser, audit, bin, bugs, c, cache, ci, cit,
    clean-install, clean-install-test, completion, config,
    create, ddp, dedupe, deprecate, dist-tag, docs, doctor,
    edit, explore, get, help, help-search, hook, i, init,
    install, install-ci-test, install-test, it, link, list, ln,
    login, logout, ls, org, outdated, owner, pack, ping, prefix,
    profile, prune, publish, rb, rebuild, repo, restart, root,
    run, run-script, s, se, search, set, shrinkwrap, star,
    stars, start, stop, t, team, test, token, tst, un,
    uninstall, unpublish, unstar, up, update, v, version, view,
    whoami

npm <command> -h  quick help on <command>
npm -l            display full usage info
npm help <term>   search for help on <term>
npm help npm      involved overview

Specify configs in the ini-formatted file:
    /home/user/.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="fd938d90bdcbd3cccdd3cf" rel="noreferrer noopener nofollow">[email protected]</a> /usr/lib/node_modules/npm

[ERROR] Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
    at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.541 s
[INFO] Finished at: 2019-09-25T11:47:14+02:00
[INFO] Final Memory: 8M/40M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:exec (npm run clean (clean)) on project

有人可以帮我解决这个问题吗?

提前致谢。

最佳答案

您可以在列表中看到 npm 命令没有可用的 clean 参数。

Usage: npm <command>

where <command> is one of:
    access, adduser, audit, bin, bugs, c, cache, ci, cit,
    clean-install, clean-install-test, completion, config,
    create, ddp, dedupe, deprecate, dist-tag, docs, doctor,
    edit, explore, get, help, help-search, hook, i, init,
    install, install-ci-test, install-test, it, link, list, ln,
    login, logout, ls, org, outdated, owner, pack, ping, prefix,
    profile, prune, publish, rb, rebuild, repo, restart, root,
    run, run-script, s, se, search, set, shrinkwrap, star,
    stars, start, stop, t, team, test, token, tst, un,
    uninstall, unpublish, unstar, up, update, v, version, view,
    whoami

npm <command> -h  quick help on <command>
npm -l            display full usage info
npm help <term>   search for help on <term>
npm help npm      involved overview

[ERROR] Command execution failed.

您可以查找npm-cleanmvn clean

关于angular - 如何使用 maven-exec-plugin 进行 npm clean?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58095637/

相关文章:

node.js - 找不到模块 “@angular-devkit/build-angular”

angular - 如何保存搜索查询并将其显示在新组件上?

css - 从组件方法中将样式应用于 Angular Toast

angular - 无法在重新加载页面上获取/登录 Angular 8 - 拒绝加载图像 '/favicon.ico',因为它违反了以下内容安全策略

Cordova - 失败 : q is not supported

java - Gradle:从下载的 POM 中获取 Maven 存储库列表

java - MySql 驱动类自动加载

angular - 在 Angular TS 版本 3.8 中绕过 TS1337 以实现自定义表单验证器

node.js - 是否有任何不依赖于 node-gyp 的 NodeJS bcrypt 模块?

java - Maven 未安装依赖项