java - grunt htmlcompressor 失败 找不到 java 错误

标签 java visual-studio gruntjs

在 Visual Studio 2015 中运行 grunt 任务 htmlcompressor 时, 任务返回 >>错误:错误:未找到:java 警告:htmlcompressor 无法压缩 html。使用 --force 继续。 由于警告而中止。 进程终止,代码为 6。

任务代码:

htmlcompressor: {
        compile: {

            files: [{
                expand: true,     // Enable dynamic expansion.
                cwd: 'Scripts/Ng-Views/',      // Src matches are relative to this path.
                src: ['**/*.html'], // Actual pattern(s) to match.
                dest: 'wwwroot/Views/',   // Destination path prefix.
            }],

            options: {
                type: 'html',
                preserveServerScript: true
            }
        }
    },

最佳答案

我认为您可能遇到了 grunt-htmlcompressor 的老问题.

在该插件的 GitHub 存储库中,有一个已关闭问题,其中包括将 PATH 环境更新为 java.exe 的解决方法。查看上一篇文章here欲了解更多信息。内容如下:

For Windows another workaround will be update "PATH" environment variable buy adding the path to "java.exe", for example: Start> Right click on "Computer"> Properties> Advanced system configuration> Advanced options (tab)> Enviroment vars> Edit PATH and add path to java.exe C: \ Program Files (x86) \ Java \ jre7 \ bin) NOTE: If you have cmd open, close it and open it again, otherwise will not work.

关于java - grunt htmlcompressor 失败 找不到 java 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41721905/

相关文章:

java - 如何使用随机类生成 3 个单词

java - 无法在 Tomcat 7 中运行 maven 项目

java - 有没有办法在不将帐户添加到设备的情况下使用 Google Sign In?

java - 选择锁定为 "FOR UPDATE"的 MySQL 记录时会抛出什么异常?

.net - Visual Studio 和 .NET 编程

c++ - 非常量引用绑定(bind)到临时的 Visual Studio 错误?

asp.net - 如何使用 Visual Studio 2013/2015 启动和运行 ASP.NET MVC 音乐商店?

javascript - 如何访问 initConfig 中设置的 grunt 任务的回调

docker - 使用 grunt-shell 调用调用 docker run 的脚本时如何解决 "the input device is not a TTY"?

less - 使用 Compass 内联 Bootstrap SASS 图像