Sp-dev-docs: Issue with SP 2016 and Gulp Serve

Created on 14 Aug 2019  路  7Comments  路  Source: SharePoint/sp-dev-docs

I was building a hello word SPFX webpart for Sharepoint 2016 and gulp serve gives me the below error in the browser. I have executed the gulp trust-dev-cert and also to debug the issue i had uninstalled the cert and closed the console and opened again and i am getting the same error

._This happens only when i selected the "SharePoint 2016 onwards, including 2019 and SharePoint Online" it works fine when i build the app for "Sharepoint Online only_ "

_If i update my serve.json to "http" :true and "initialpage" : "http://localhost:5432/workbench" it works with that but not with HTTPS_

Browser - IE
Can鈥檛 reach this page
鈥ake sure the web address https://localhost:5432 is correct

Browser - Chrome
This site can鈥檛 provide a secure connection
localhost sent an invalid response.
Try running Windows Network Diagnostics..

I am using node Version - v10.16.0
npm version - 6.9.0

Category

  • [ ] Question
  • [ ] Typo
  • [x] Bug
  • [ ] Additional article idea

The output of Gulp trust-dev-cert

Build target: DEBUG
[14:37:48] Using gulpfile C:\Projects\SPFX\Webparts\SPFXAssets\gulpfile.js
[14:37:48] Starting gulp
[14:37:48] Starting 'trust-dev-cert'...
[14:37:48] Starting subtask 'trust-cert'...
[14:37:49] [trust-cert] Attempting to trust a dev certificate. This self-signed certificate only points to localhost and will be stored in your local user profile to be used by other instances of gulp-core-build-serve. If you do not consent to trust this certificate, click "NO" in the dialog.
[14:37:51] Finished subtask 'trust-cert' after 3.28 s
[14:37:51] Finished 'trust-dev-cert' after 3.28 s
[14:37:52] ==================[ Finished ]==================
[14:37:52] Project spfx-assets version: 0.0.1
[14:37:52] Build tools version: 2.5.3
[14:37:52] Node version: v10.16.0
[14:37:52] Total duration: 5.75 s
tooling answered question

All 7 comments

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

Please see the documentation for "SPFx Development for SharePoint Server 2016" in the "SPFx Set up your Development Environment".

https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-development-environment#spfx-development-for-sharepoint-server-2016

You need to instruct NodeJS to use HTTP1 instead of HTTP2 because of changes that happened to NodeJS in v8+

Hello
Actually i had followed the #1002 and set the environmental variable and also updated my package.json "scripts": { "dev" : "set NODE_NO_HTTP2=1&& gulp serve", But i am still getting the same error

Try changing config\serve.json https flag to http and altering https to http in the initial page parameter as well (I copied my serve.json for you below) - that worked for me. I have #4485 open to see if this is a known limitation due to targeting SPFx v1.1 or a missing configuration on my end.

{ "$schema": "https://developer.microsoft.com/json-schemas/core-build/serve.schema.json", "port": 4321, "https": true, "initialPage": "https://localhost:5432/workbench", "api": { "port": 5432, "entryPath": "node_modules/@microsoft/sp-webpart-workbench/lib/api/" } }

Thanks Bassem actually HTTP was working its only with HTTPS the gulp serve is failing

Closing issue as "answered". If you encounter similar issue(s), please open up a NEW issue. Thank you.

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

Was this page helpful?
0 / 5 - 0 ratings