gpt4 book ai didi

javascript - VSCode Launch.json 配置无法启动 :desktop -- --app excel fails error 1 for Excel Office-Addin

转载 作者:行者123 更新时间:2023-12-04 22:14:13 27 4
gpt4 key购买 nike

按照教程 Tutorial Create an Excel Addin .
已使用命令行完成并测试了本教程的第一部分。
尝试使用 vscode 中的调试器运行和调试 taskpane.js 使用 Excel 桌面(Edge 旧版) .
它因以下调试错误而失败,简而言之,缺少脚本: start:desktop -- --app excel
这是 vscode 1.53.0 Issue 115876 的已解决问题.但是,阅读此内容我不确定如何更新 launch.json 来解决它。
我正在使用 VSCODE 1.64.1
这是我的 Excel 桌面配置(Edge Legacy)

 {
"name": "Excel Desktop (Edge Legacy)",
"type": "office-addin",
"request": "attach",
"url": "https://localhost:3000/taskpane.html?_host_Info=Excel$Win32$16.01$en-US$$$$0",
"port": 9222,
"timeout": 600000,
"webRoot": "${workspaceRoot}",
"preLaunchTask": "Debug: Excel Desktop",
"postDebugTask": "Stop Debug"
},
调试输出
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'start:desktop -- --app excel'
1 verbose cli ]
2 info using npm@6.14.13
3 info using node@v14.17.3
4 verbose stack Error: missing script: start:desktop -- --app excel
4 verbose stack at run (C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:155:19)
4 verbose stack at C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:63:5
4 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:116:5
4 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:436:5
4 verbose stack at checkBinReferences_ (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:391:45)
4 verbose stack at final (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:434:3)
4 verbose stack at then (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:161:5)
4 verbose stack at ReadFileContext.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:350:20)
4 verbose stack at ReadFileContext.callback (C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:123:16)
4 verbose stack at FSReqCallback.readFileAfterOpen [as oncomplete] (fs.js:282:13)
5 verbose cwd C:\Users\PC_User\office_projects\My Office Add-in
6 verbose Windows_NT 10.0.19044
7 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "start:desktop -- --app excel"
8 verbose node v14.17.3
9 verbose npm v6.14.13
10 error missing script: start:desktop -- --app excel
11 verbose exit [ 1, true ]
编辑
包.json
{
"name": "office-addin-taskpane-js",
"version": "0.0.1",
"repository": {
"type": "git",
"url": "https://github.com/OfficeDev/Office-Addin-TaskPane-JS.git"
},
"license": "MIT",
"config": {
"app_to_debug": "excel",
"app_type_to_debug": "desktop",
"dev_server_port": 3000
},
"scripts": {
"build": "webpack --mode production",
"build:dev": "webpack --mode development",
"dev-server": "webpack serve --mode development",
"lint": "office-addin-lint check",
"lint:fix": "office-addin-lint fix",
"prettier": "office-addin-lint prettier",
"start": "office-addin-debugging start manifest.xml",
"start:desktop": "office-addin-debugging start manifest.xml desktop",
"start:web": "office-addin-debugging start manifest.xml web",
"stop": "office-addin-debugging stop manifest.xml",
"validate": "office-addin-manifest validate manifest.xml",
"watch": "webpack --mode development --watch"
},
"dependencies": {
"core-js": "^3.9.1",
"regenerator-runtime": "^0.13.7"
},
"devDependencies": {
"@babel/core": "^7.13.10",
"@babel/preset-env": "^7.12.11",
"@babel/preset-typescript": "^7.13.0",
"@types/office-js": "^1.0.180",
"@types/office-runtime": "^1.0.17",
"acorn": "^8.5.0",
"babel-loader": "^8.2.2",
"copy-webpack-plugin": "^9.0.1",
"eslint-plugin-office-addins": "^2.0.0",
"file-loader": "^6.2.0",
"html-loader": "^2.1.2",
"html-webpack-plugin": "^5.3.2",
"office-addin-cli": "^1.3.5",
"office-addin-debugging": "^4.3.8",
"office-addin-dev-certs": "^1.7.7",
"office-addin-lint": "^2.0.0",
"office-addin-manifest": "^1.7.7",
"office-addin-prettier-config": "^1.1.4",
"os-browserify": "^0.3.0",
"process": "^0.11.10",
"source-map-loader": "^3.0.0",
"ts-loader": "^9.2.5",
"typescript": "^4.3.5",
"webpack": "^5.50.0",
"webpack-cli": "^4.8.0",
"webpack-dev-server": "4.7.3"
},
"prettier": "office-addin-prettier-config",
"browserslist": [
"ie 11"
]
}

最佳答案

我刚刚尝试根据您的描述创建一个新的 Excel 加载项并在调试器下运行它。一切顺利,没有问题。但我用过Edge (Chromium)启动部分中的选项。
似乎 package.json文件在 scripts 中不包含相应的命令部分,以下错误消息清楚地说明了这一点:

4 verbose stack Error: missing script: start:desktop -- --app excel
我建议使用 yeoman 生成器生成一个新的加载项项目并检查那里的脚本部分。不要忘记更新 yeoman 本身。
例如,在 Outlook 加载项中,我在脚本部分看到以下命令:
"start:desktop": "office-addin-debugging start manifest.xml desktop",

关于javascript - VSCode Launch.json 配置无法启动 :desktop -- --app excel fails error 1 for Excel Office-Addin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71043383/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com