IMT*_*Man 5 visual-studio-code vscode-tasks
我正在使用https://github.com/google/clasp进行开发。clasp将使用环境变量clasp_config_auth。我已经测试并确认,在 VS Code 之外,如果我设置了环境变量,clasp_config_auth然后clasp就会选择它并按预期工作。
但在 VS Code 中却无法按预期工作。
我的 中有以下内容tasks.json:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"options": {
"env": {
"clasp_config_auth": "~/path/to/file/.clasprc.json.me"
}
},
"windows": {
"options": {
"env": {
"clasp_config_auth": "%userprofile%\\path\\to\\file\\.clasprc.json",
}
}
},
"tasks": [
{
"label": "push to GAS",
"type": "shell",
"command": "clasp push",
"group": {
"kind": "build",
"isDefault": true
},
}
]
}
Run Code Online (Sandbox Code Playgroud)
现在,如果我尝试运行该push to GAS任务,则会收到以下错误:
> Executing task: clasp push <
ENOENT: no such file or directory, open 'C:\Users\me\Documents\work\project\%userprofile%\path\to\file\.clasprc.json'
The terminal process "C:\windows\System32\cmd.exe /d /c clasp push" terminated with exit code: 1.
Run Code Online (Sandbox Code Playgroud)
C:\Users\me\Documents\work\project\是我的项目的当前工作目录。
看起来 VS Code 没有正确设置环境变量,因此clasp选择C:\Users\me\Documents\work\project\%userprofile%\path\to\file\.clasprc.json了%userprofile%\path\to\file\.clasprc.jsonor C:\Users\me\path\to\file\.clasprc.json。
如果我在命令提示符中设置环境变量并运行它,clasp push它将按预期工作。但在 VS Code 中则不然。
| 归档时间: |
|
| 查看次数: |
993 次 |
| 最近记录: |