1

我有一个咕噜脚本来启动Angular 2构建。在命令行上运行grunt成功 - Angular构建按预期运行。Angular的Grunt-shell任务在VS Task Runner Explorer中失败,但在命令提示符下工作

从VS 2017中的任务运行器资源管理器运行任务失败。

的Gruntfile.js如下:

module.exports = function (grunt) { 

    grunt.initConfig({ 

     shell: { 
      options: { 
      stderr: false 
      }, 
      angularBuild: { 
       command: 'ng build --prod' 
      } 
     } 

    }); 

    grunt.loadNpmTasks('grunt-shell'); 

    grunt.registerTask('default', ['shell']); 
}; 

在任务运行资源管理器的输出是:

D:\Work> cmd.exe /c grunt -b "D:\Work" --gruntfile "D:\Work\Gruntfile.js" default --color 
Running "shell:angularBuild" (shell) task 
Warning: Command failed: C:\WINDOWS\system32\cmd.exe /s /c "ng build --prod" 
D:\Work\node_modules\@angular\cli\models\config\config.js:17 
    constructor(_configPath, schema, configJson, fallbacks = []) { 
                 ^
SyntaxError: Unexpected token = 
    at exports.runInThisContext (vm.js:53:16) 
    at Module._compile (module.js:373:25) 
    at Object.Module._extensions..js (module.js:404:10) 
    at Module.load (module.js:343:32) 
    at Function.Module._load (module.js:300:12) 
    at Module.require (module.js:353:17) 
    at require (internal/module.js:12:17) 
    at Object.<anonymous> (D:\Work\node_modules\@angular\cli\models\config.js:3:18) 
    at Module._compile (module.js:397:26) 
    at Object.Module._extensions..js (module.js:404:10) 
Use --force to continue. 
Aborted due to warnings. 
Process terminated with code 6. 

回答

相关问题