我用:
我的问题是,有些任务是可行的,而有些则不行。
这里是我的tasks.json文件。
{
"version": "2.0.0",
"tasks": [
{ // This task work fine.
"label": "tsc",
"type": "typescript",
"tsconfig": "tsconfig.json",
"group": {
"kind": "build",
"isDefault": true
}
},
{ // This task work fine.
"taskName": "css",
"type": "shell",
"command": "./scss.sh",
"windows": {
"command": "./scss.cmd"
},
"presentation": {
"reveal": "always",
"panel": "new"
}
},
{ // This task not work. (See output #1 below)
"taskName": "npm-install",
"type": "shell",
"command": "npm install",
"problemMatcher": [],
"presentation": {
"reveal": "always",
}
},
{ // This task not work. (See output #2 below)
"type": "gulp",
"task": "clean",
"problemMatcher": []
}
]
}
输出#1 -当我尝试使用shell\ npm 类型运行npm任务时,得到相同的结果:
> Executing task: npm install <
Usage: npm <command>
where <command> is one of:
access, adduser, bin, bugs, c, cache, completion, config,
ddp, dedupe, deprecate, dist-tag, docs, edit, explore, get,
help, help-search, i, init, install, install-test, it, link,
list, ln, login, logout, ls, outdated, owner, pack, ping,
prefix, prune, publish, rb, rebuild, repo, restart, root,
run, run-script, s, se, search, set, shrinkwrap, star,
stars, start, stop, t, tag, team, test, tst, un, uninstall,
unpublish, unstar, up, update, v, version, view, whoami
npm <cmd> -h quick help on <cmd>
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:
C:\Users\usr\.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config
npm@3.10.10 C:\Program Files\nodejs\node_modules\npm
输出#2 --当我尝试运行gulp任务时,我得到了下一步(gulp包安装为全局(npm install gulp -g
),(有正确内容的gulpfile.js )):
> Executing task: node_modules\.bin\gulp.cmd clean <
clean: node_modules.bingulp.cmd: command not found
我可以像往常一样使用cmd中的gulp、npm、node和其他工具,它可以正常工作,但在VS代码中不行。
目前这个问题的解决方案:
是的,它工作得很好,但是对于简单的任务,你需要做太多的动作。
在这方面你有什么建议?
发布于 2017-08-05 03:58:52
我找到了这个问题的解决方案,问题是在默认的终端应用程序中。
默认情况下,在Windows visual studio代码中,使用powershell作为终端应用程序,在我的示例中,我将其更改为git-bash应用程序,并遇到了这个问题。在那之后,我把它改为powershell,一切都很好。
我不关心为什么gitbash不能工作,可能在vs代码的配置中需要额外的配置。
发布于 2017-07-21 15:46:40
这是VS代码中的问题。在命令末尾添加一个<
,使它们失败。目前似乎还没有一个直接的解决办法。
https://stackoverflow.com/questions/45241941
复制相似问题