sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

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

Open NehaJantre opened this issue 8 years ago • 10 comments

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: image

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

NehaJantre avatar Jun 18 '18 21:06 NehaJantre

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 avatar Jul 12 '18 13:07 SteenW

@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"

NehaJantre avatar Jul 13 '18 17:07 NehaJantre

@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.

NehaJantre avatar Jul 17 '18 22:07 NehaJantre

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 avatar Jul 18 '18 11:07 andrewconnell

@andrewconnell Thank you for your response. Yes the 2nd option works for me.

NehaJantre avatar Jul 31 '18 20:07 NehaJantre

@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.

chrisforbesblogs avatar Aug 27 '18 14:08 chrisforbesblogs

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.

msekkappan avatar Sep 12 '18 14:09 msekkappan

I fixed my debugging problem in Chrome on the Hosted workbench by adding the following to sourceMapPathOverrides:

"webpack:///.././src/*": "${webRoot}/src/*",

lennertcc avatar Sep 25 '18 15:09 lennertcc

Please use #2507 as workaround. I'm going to resolve this.

GrahamMcMynn avatar Dec 17 '18 21:12 GrahamMcMynn

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

msft-github-bot avatar Jan 27 '20 12:01 msft-github-bot