7

I am new to SPFx, tried to create simple webpart using SPFx. Referred from here.

Followed these steps:
-Installed nodejs
-Installed gulp & yomen using npm install -g yo gulp in powershell.
-Loaded sharepoint framework using npm install -g @microsoft/generator-sharepoint

-Now created a new directory using md helloworldspfx
-Navigated to the directory cd helloworldspfx
-Tried to create the webpart using yo @microsoft/sharepoint
-Installed developer certificate gulp trust-dev-cert
-Tried to build & preview the webpart using gulp serve

Now workbench page opens up in chrome like this, enter image description here

There is no error showing in the windows powershell.
Please help.

SOLUTION:
I have been using Node.js v8.9.
With the help of answer setting the NODE_NO_HTTP2=1 environment variable to disable the experimental feature.
Like this, $env:NODE_NO_HTTP2="1" in powershell (set NODE_NO_HTTP2=1 in CMD) to fix the issue.

2
  • Did you try deleting .gcb-serve-data directory and running gulp trust-dev-cert again. See github.com/Microsoft/…
    – Bunzab
    Commented Nov 2, 2017 at 13:52
  • @Bunzab tried deleting .gcb-serve-data diretory & installed development certificate, but no change...
    – Vishnu S
    Commented Nov 3, 2017 at 4:05

2 Answers 2

9

Are you using Node.js v8 by any chance? If so, there is a known issue with the http/2 experimental feature. You can disable it by setting the NODE_NO_HTTP2=1 environment variable. More information about the fix is available at https://github.com/SharePoint/sp-dev-docs/issues/1002.

5
  • Thanks guys! On Mac you run it on the command line like this: NODE_NO_HTTP2=1 gulp serve Commented Nov 7, 2017 at 16:09
  • I'm having the same issue.But this solution not worked for me. Still having the same issue. Node.js 9.4.0...
    – Jerry
    Commented Jan 15, 2018 at 13:23
  • 1
    Node v9 (same as v8 btw) is not yet supported by SPFx. You should downgrade to at least v8, or even the recommended v6 which has been tested with SPFx. Commented Jan 16, 2018 at 18:28
  • Node v8 is now supported by SPFx but you still need to apply the $env:NODE_NO_HTTP2="1" PowerShell command in the same PowerShell window as you run gulp serve. Commented Jun 1, 2018 at 8:22
  • 2
    am using node v 10, am facing the same issue, even after setting the variable it's not working
    – JishinK
    Commented May 20, 2019 at 17:52
0

Same issue here - I guess in our network there's no certificate for localhost? Worked around it by changing to http in config > serve.json:

"initialPage": "http://localhost:5432/workbench",
"https": false,

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.