OfficeDev / generator-office

Yeoman generator for building Microsoft Office related projects.
https://www.npmjs.com/package/generator-office
MIT License
824 stars 208 forks source link

Localhost loopback for Microsoft Edge WebView cannot work #671

Closed dukechain2333 closed 2 years ago

dukechain2333 commented 2 years ago

Debugging is being started... App type: desktop ? Allow localhost loopback for Microsoft Edge WebView? Yes Error: Unable to start debugging. :

millerds commented 2 years ago

Can you provide some details behind the scenario the produced this output?

dukechain2333 commented 2 years ago

I am using windows 11 and my Edge version is 95.0.1020.30, npm version 14.17.4.

I was trying to develop an addin on excel through JavaScript.

dukechain2333 commented 2 years ago

If I choose not to allow localhost loopback for Microsoft Edge Webview, the excel will pop up. But still can't use the addin, instead it will tell me this. image image

millerds commented 2 years ago

The popup with the attach message is intentional as it enables debugging add-in loading code (i.e. your OnReady method). The error in the add-in is a result of the configuration being incorrect. There is a dev cert that is need (you should have been prompted for that) and loopback needs to be enabled, These things are necessary in order to run the add-in locally on the machine (as opposed to pushing you to get some web hosting space).

Thanks for the info . . . I'm assuming that is the Node version as npm doesn't have versions that high (their most recent major version is 8). Is this a new project created with 'yo office' or something existing? What commands are you running that outputs that error?

The error shown in the first comment isn't necessarily connected to the loopback setting as it's a generic error related to trying to start the debug server providing the add-in content. Seems like part of the error is missing and more information should be provided after "Error: Unable to start debugging."

You could try running these commands directly to see if you get more error information:

dukechain2333 commented 2 years ago

I tried the same procedure on the virtual machine (Windows 10 on VMWare ) and everything is all right.

The problem may be caused by some env errors on my machine (and I have no clue on it cause this is actually my first project using nodejs)

Also I have tried your command npx office-addin-dev-settings appcontainer EdgeWebView --loopback and it shows this.

? Allow localhost loopback for Microsoft Edge WebView? Yes  
Error: Unable to allow loopback for the appcontainer.
:

This is all it shows.

millerds commented 2 years ago

Can you run the following and provide the output of each command:

Also . . . what version of Office is installed on that machine?

dukechain2333 commented 2 years ago

The first command's output is like this. image And the second one is this. image And I am using Microsoft 365.

dukechain2333 commented 2 years ago

I have found some materials that told me to turn on the loopback in the Edge. But I can't even find it in about:flags (I assume it is due to the upgrade on Edge).

millerds commented 2 years ago

What's the specific version of Office that is install (look in File->Account for that information)?
Also what specific version of edge is installed (Look in Help and feedback->About of the ... menu) ? In what window did run those commands (doesn't look like a terminal window I'm used to seeing)?

dukechain2333 commented 2 years ago

My Excel Version is Version 2110 Build 16.0.14527.20168 Edge version is 95.0.1020.38 I ran those commands in powershell (it may look strange because I am using Windows Terminal and has a theme on it).

millerds commented 2 years ago

Did you run them in PowerShell or windows terminal? I think there might be a bug with running them in PowerShell instead of regular windows terminal.

dss010101 commented 1 year ago

Allow localhost loopback for Microsoft Edge WebView

so that dialogue always pops up, even you select 'Yes' to 'Allow localhost loopback for Microsoft Edge WebView?'?

my issues is the dialog always pops up - and i click ok. im able to step through code initially; for example if i click on the 'run me' button in the pane, but the moment i click on the ribbon button, the npm server stops and that's it.

i built a word w/ Edge chromium project using Yo

tsuyoshi-fukuzawa commented 6 months ago

After running the command prompt as administrator, npm start could be started without any problems.