Add arguments property to npm tasks
See original GitHub issueDoes this issue occur when all extensions are disabled?: Yes
- VS Code Version: 1.63.2
- OS Version: Windows 11 (10.0.22000.376)
This has been reported before (#128569), but that issue is locked as “not reproducible”. The default Office.js add-ins created using Yeoman generator create several launch configurations. The one for Microsoft Word looks like this:
{
"name": "Word Desktop (Edge Chromium)",
"type": "pwa-msedge",
"request": "attach",
"useWebView": true,
"port": 9229,
"timeout": 600000,
"webRoot": "${workspaceRoot}",
"preLaunchTask": "Debug: Word Desktop",
"postDebugTask": "Stop Debug"
},
preLaunchTask
refers to an entry in tasks.json
that is defined like this:
{
"label": "Debug: Word Desktop",
"type": "npm",
"script": "start:desktop -- --app word",
"presentation": {
"clear": true,
"panel": "dedicated",
},
"problemMatcher": []
},
start:desktop
is defined in package.json
:
"start:desktop": "office-addin-debugging start manifest.xml desktop",
Trying to launch this configuration, I see the following error:
> Executing task: npm run "start:desktop -- -- app word" <
npm ERR! Missing script: "start:desktop -- -- app word"
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR! npm run
It is basically the npm run
tasks with command-line argument, which fails saying that it can’t locate the script. Interestingly, running the task directly from the terminal launches it successfully:
$ npm run start:desktop -- --app word
> office-addin-taskpane@0.0.1 start:desktop
> office-addin-debugging start manifest.xml desktop "--app" "word"
Debugging is being started...
App type: desktop
Enabled debugging for add-in 216e8727-a1f1-4fad-9421-a768af6ab77c.
Starting the dev server... (webpack serve --mode development)
The dev server is running on port 3000. Process id: 19976
Sideloading the Office Add-in...
Debugging started.
From this, I conclude that this has got something to do with how arguments are being handled/passed by the task.
Steps to Reproduce:
- Install yeoman and office-generator (
npm install -g yo generator-office
) - Run
yo office
in an empty folder. Choose Typescript, Word and Task Pane Project options. - Select
Word Desktop (Edge Chromium)
debug configuration and start debugging. There you go!
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:13 (6 by maintainers)
Top GitHub Comments
@meganrogge IIRC this would be for adding args that would be passed to the npm command (added in the npm extension), not to the shell.
@gthaker the
shell
workaround should work bc as you mentioned, running it directly in the terminal works and that’s what happens wshell
tasks