在 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/