如何在vscode中修复gulp windows脚本主机错误

问题描述 投票:0回答:1

Gulp手表任务跑步者错误。它导致Windows脚本主机错误。

我已经尝试更改文件task.json:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "command": "gulp",
    "isShellCommand": true,
    "args": [
        "--no-color"
    ],
    "tasks": [
        {
            "taskName": "scripts",
            "isBuildCommand": true,
            "showOutput": "always"
        },
        {
            "taskName": "sass",
            "isBuildCommand": true,
            "showOutput": "always"
        },
        {
            "taskName": "watch",
            "isBuildCommand": true,
            "showOutput": "always"
        }
    ]
}
javascript visual-studio-code gulp vscode-tasks
1个回答
0
投票

看起来您使用的是较旧的语法。我不相信taskname不再受支持了。

这是我使用的tasks.json文件,两种调用gulp命令的方法都有效。 (你提到task.json,我认为这是一个错字,它是tasks.json

{
"version": "2.0.0",
"tasks": [
    {
        "label": "Start server and process files",
        "command": "gulp",
        "args": [
            "sync"
        ],
        "type": "shell",
        "options": {
            "cwd": "${workspaceRoot}"
        }
    },
    {
        "label": "Gulp: Start server only",

        "type": "gulp",
        "task": "serve",
        "problemMatcher": []
    },
    {
        "label": "Gulp: watch",

        "type": "gulp",
        "task": "watch",
        "problemMatcher": []
    }
}

看起来你也想要:

"group": "build",

在您的每个任务中 - 替换您在上面使用的isBuildCommand语法。

和:

"presentation": {
  "reveal": "always",
},

而不是showoutput语法。

migrating to tasks 2.0 documentation

© www.soinside.com 2019 - 2024. All rights reserved.