我用:VS代碼任務2.0煩惱
- VS代碼1.14.1
- 任務2.0
- 節點6.11.1
我的問題是,一些任務工作,和有些不是。
這裏我的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 - 當我試圖運行與類型外殼\ 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
[email protected] C:\Program Files\nodejs\node_modules\npm
輸出#2 - 當我嘗試(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代碼中。
當前的這件事的解決方案:
- 每個東西創建批處理文件。
- 爲每個批處理文件創建shell任務(如scss.cmd)
- 運行這些任務。
是的,它運作良好,但您需要爲簡單的任務做太多的動作。
您可以在這方面提供什麼建議?