Cannot add webpart on running "gulp serve --nobrowser" command and debugging in Local Workbench after upgrading sharepoint to version 1.5.0 and 1.5.1
Category
- [ ] Question
- [ ] Typo
- [x] Bug
- [ ] Additional article idea
Expected or Desired Behavior
On running "gulp serve --nobrowser" command in the terminal and debugging in Local Workbench, we should be able to add the sharepoint webpart.
Observed Behavior
The browser opens with the localhost url and is blank. On viewing console in the Developer Tools, it shows the following errors:

Also, the Debug Console in the VSCode shows the following error:

I have tried to install the newest SPFx dev environment on three W10 machines today. They all work fine except when trying to debug using gulp serve --nobrowser. I get the same error as described above i.e. Failed to load ressource "https://localhost:4321/temp/workbench-packages/@microsoft_sp-loader/dist/sp-loader-assembly_en-us.js".
However if I try to load the file in normal mode (gulp serve) it works fine. So it seems to be related to running in "--nobrowser" mode.
@SteenW..Yes you are right. It works for me as well when I use "gulp serve" but in order to debug in VScode, I tried using "gulp serve --nobrowser" but it gave me the above error and didn't hit the breakpoint. But I have tried using "gulp serve --nobrowser" in Sharepoint version 1.4.1 and it works fine for debugging. So, I guess the latest version of Sharepoint has some issue to run "gulp serve --nobrowser"
@VesaJuvonen Can you please help solve this issue? I am not able to debug in VScode using "gulp serve --nobrowser" using "Debugger for Chrome" extension as it is giving me the above error. Thank you.
The issue is that something broke in a recent SPFx update with a dependency. When running gulp serve --nobrowser, none of the necessary packages to run the workbench are copied into the ./temp/workbench-packages.
Until this is fixed, I have two workarounds:
(1) copy the files from the above folder when running gulp serve to a safe location, then when you run gulp serve --nobrowser, copy that folder back in, replacing the empty ./temp/workbench-packages folder
(2) start the webserver with the browser (gulp serve), then kill all instances of the browser. Now you can attach the VSCode debugger
@andrewconnell Thank you for your response. Yes the 2nd option works for me.
@andrewconnell neither of those options worked for me? I can downgrade the solution to 1.4.1 and that works but that's not great.
Debugging with https://your-sharepoint-tenant.sharepoint.com/_layouts/workbench.aspx works provided you are logged in to Chrome. Chrome does not prompt for user name/password.
I fixed my debugging problem in Chrome on the Hosted workbench by adding the following to sourceMapPathOverrides:
"webpack:///.././src/*": "${webRoot}/src/*",
Please use #2507 as workaround. I'm going to resolve this.
Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues