Node.js 在visual studio代码中调试outlook的web加载项
我遵循了创建高级Outlook加载项的教程 上面是一个node.js-应用程序,它使用Yeoman和Microsoft Office插件项目生成器。要简单地启动外接程序,只需在根项目文件夹中键入“npm start” 但是:我想在Visual Studio代码中调试外接程序 当您想要调试项目时,VS代码会自动创建一个Node.js 在visual studio代码中调试outlook的web加载项,node.js,visual-studio-code,outlook-addin,bsconfig,Node.js,Visual Studio Code,Outlook Addin,Bsconfig,我遵循了创建高级Outlook加载项的教程 上面是一个node.js-应用程序,它使用Yeoman和Microsoft Office插件项目生成器。要简单地启动外接程序,只需在根项目文件夹中键入“npm start” 但是:我想在Visual Studio代码中调试外接程序 当您想要调试项目时,VS代码会自动创建一个launch.json文件。此文件如下所示: "configurations": [ { "type": "node",
launch.json
文件。此文件如下所示:
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}\\bsconfig.json"
}
]
{
"ui": {
"port": 3000
},
"server": {
"routes": {
"/node_modules": "node_modules"
}
},
"https": {
"key": "./certs/server.key",
"cert": "./certs/server.crt"
},
"watch": true,
"files": "*.*"
}
但是,调试时出现以下错误:
无法启动程序'c:\ZTesting\outlooktest\bsconfig.json'
;背景
outFiles
属性可能会有所帮助
那么,这些外部文件是否真的是问题所在?如果是,它们应该是什么?
如果没有,调试使用node.js、Yeoman和Microsoft Office插件项目生成器创建的web插件的解决方案是什么
bsconfig.json
文件如下所示:
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}\\bsconfig.json"
}
]
{
"ui": {
"port": 3000
},
"server": {
"routes": {
"/node_modules": "node_modules"
}
},
"https": {
"key": "./certs/server.key",
"cert": "./certs/server.crt"
},
"watch": true,
"files": "*.*"
}
我没有找到如何在VisualStudio代码中调试上面的外接程序。但是,可以从Windows 10使用F12 developer应用程序调试外接程序
您可以在此处找到有关F12应用程序的更多信息:
我也有同样的问题。根本原因是应用程序实际上没有在服务器上运行npm start
实际上运行一个单独的程序,称为webpack。您可以通过打开package.json看到这一点。应该有一行如下所示:
"start": "webpack-dev-server --mode development --https --key ./certs/server.key --cert ./certs/server.crt --cacert ./certs/ca.crt --port 3000"
当您运行npm start
时,在运行该行之前。所以这个脚本实际上是在调用一个名为node_modules/.bin/webpack dev server的可执行文件Webpack不运行index.js中的任何代码。它“打包”代码,并通过https向客户端广播
由于应用程序代码仅在客户端上运行,因此只能在客户端上调试。使用npm start
使您看起来像是在编写服务器代码,但外接程序实际上正在运行客户端。我今天也遇到了同样的问题。
但是,如果WIN10 F12应用程序无法打开您的html文件,则有一种棘手的方法来调试outlook加载项
在outlook中调试外接程序时,可以使用tbody.append显示任何值
var tbody = $('.prop-table');
tbody.append(makeTableRow("asyncResult: ", item));
function makeTableRow(name, value) {
return $("<tr><td><strong>" + name +
"</strong></td><td class=\"prop-val\"><code>" +
value + "</code></td></tr>");
}
F12应用程序似乎无法打开outlook加载项。当我点击F12应用程序中的外接程序时,什么也没有发生