Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run gulp serve with 'NODE_NO_HTTP2=1' when using SPFx on node v8 #1002

Closed
waldekmastykarz opened this issue Nov 1, 2017 · 34 comments
Closed

Run gulp serve with 'NODE_NO_HTTP2=1' when using SPFx on node v8 #1002

waldekmastykarz opened this issue Nov 1, 2017 · 34 comments

Comments

@waldekmastykarz
Copy link
Collaborator

@waldekmastykarz waldekmastykarz commented Nov 1, 2017

Category

  • Question
  • Typo
  • Bug
  • Additional article idea
  • Tip

When working with SPFx on Node.js v8 you have to run gulp serve, like:

NODE_NO_HTTP2=1 gulp serve

if you call gulp serve without the extra flag, you won't be able to open the workbench in the browser. This is caused by the experimental http/2 feature that is a part of Node v8.

@Mike-tech
Copy link

@Mike-tech Mike-tech commented Nov 1, 2017

@waldekmastykarz i tried this command but getting: The term 'NODE_NO_HTTP2=1' is not recognised as the name of a cmdlet.

Also same thing when i try the command from Node.js command prompt: 'NODE_No_HTTP2' is not recognised as an internal or external command.

I am on Node v8.9.0

Thanks

@waldekmastykarz
Copy link
Collaborator Author

@waldekmastykarz waldekmastykarz commented Nov 2, 2017

I assume you're on Windows. See the following article to see how to set an environment variable for Node on Windows: https://stackoverflow.com/questions/9249830/how-can-i-set-node-env-production-on-windows

@Mike-tech
Copy link

@Mike-tech Mike-tech commented Nov 3, 2017

Yes i am using Windows. My node js path is already in environment variable. I tried the commands 'set NODE_NO_HTTP2=1' but made no impact, even after restart. I tried different combination in that page but no avail.
I've had downgraded to Node v6.11. Although it would be nice to know the exact command required to work with the latest version.

@waldekmastykarz
Copy link
Collaborator Author

@waldekmastykarz waldekmastykarz commented Nov 3, 2017

@Mike-tech have you also tried the following:

To set environment variables globally so they persist beyond just the single command prompt, you can find the tool from System in Control Panel (or by typing 'environment' into the search box in the start menu).

@waldekmastykarz
Copy link
Collaborator Author

@waldekmastykarz waldekmastykarz commented Nov 3, 2017

Confirmed: above works. After adding the environment variable, I had to restart my terminal (cmder) for the change to work.

@Mike-tech
Copy link

@Mike-tech Mike-tech commented Nov 3, 2017

Can please verify my settings - i did restart after setting this: is this right?

image

@iclanton
Copy link
Contributor

@iclanton iclanton commented Nov 3, 2017

Because Node 8 went into LTS on November 1st, we'll be working on supporting it soon. For now only Node 6 is officially supported in SPFx.

However, setting the NO_NODE_HTTP2 environment variable to 1 worked when I just tried it on Windows.

@waldekmastykarz
Copy link
Collaborator Author

@waldekmastykarz waldekmastykarz commented Nov 3, 2017

@Mike-tech that's exactly the setting I have and it's working for me.

@Mike-tech
Copy link

@Mike-tech Mike-tech commented Nov 3, 2017

@waldekmastykarz Many thanks for confirming that. Perhaps it's because i've now downgraded to node v6??? I will have to check this another time. I'm busy working on a SPFx project, so will stay with the stable v6. Cheers

@Ofer-Gal
Copy link

@Ofer-Gal Ofer-Gal commented Dec 24, 2017

in package.json enter:

"scripts": {
    "dev" : "set NODE_NO_HTTP2=1&& gulp serve",

then npm run dev or yarn dev will work for you
This is how you add evironament variable befor node command I guess

@casvaniersel
Copy link

@casvaniersel casvaniersel commented Jan 9, 2018

Saved the day dude :) thanks @waldekmastykarz !

@HeToC
Copy link

@HeToC HeToC commented Jan 12, 2018

does not work for me on my mac
nodejs v 9.4.0

@andrewconnell andrewconnell mentioned this issue Jan 15, 2018
1 of 1 task complete
@lifayt
Copy link

@lifayt lifayt commented Feb 2, 2018

Echoed - this does not solve the issue on Mac.

@andrewconnell
Copy link
Collaborator

@andrewconnell andrewconnell commented Feb 2, 2018

There's a known issue with Node.js v9 that does not respect the NODE_NO_HTTP2 environment variable.

This DOES work on MacOS @lifayt if you are using Node v8 ... provided more detail in your other recent post: #1241 (comment)

@lifayt
Copy link

@lifayt lifayt commented Feb 2, 2018

Cheers, thank you!

@pankajsurti
Copy link

@pankajsurti pankajsurti commented Feb 9, 2018

I tried all install and uninstall of Node, NPM, Gulp & SpX. I was thinking I was missing the step with the documentation. But this post helped me. I added NODE_NO_HTTP2=1 in the environment variable and it worked. Thanks. This should be mentioned in the documentation of the SPx

@andrewconnell
Copy link
Collaborator

@andrewconnell andrewconnell commented Feb 9, 2018

@pankajsurti I don't think it should be addressed. The docs clearly state SPFx is supported with Node.js v6.*.

This env variable is only required for Node.js v8+... since they don't support it, calling it out adds confusion IMHO. Plus, I think the team is working on their workbench to resolve this.

@andrewconnell
Copy link
Collaborator

@andrewconnell andrewconnell commented Feb 16, 2018

Aaaaaaannnnd this is resolved in the Yeoman Generator v1.4.1. Upgrade to that version for no workaround to use Node.js v8 LTS.

@nickpape nickpape mentioned this issue Feb 16, 2018
0 of 4 tasks complete
@btastic
Copy link

@btastic btastic commented Feb 19, 2018

I just tried the new yeoman generator 1.4.1 with Node.js 8.9.4 and it is still giving me ERR_SSL_PROTOCOL_ERROR in chrome and IE.

Machine is a windows server 2016 datacenter hosted in azure
Workflow:

  1. Downloaded and installed node.js 8.9.4 LTS

  2. npm install -g yo gulp

  3. npm install -g @microsoft/generator-sharepoint

  4. yo @microsoft/sharepoint

Entered a solution name
Sharepoint 2016 onwards, including Sharepoint Online
Use the current folder
MyProjectName
MyProjectName description
React
  1. gulp trust-dev-cert
    Clicked OK at the prompt

  2. gulp serve

Did I miss something?

Edit: doing the exact same steps on node.js 6.13.0 works perfectly fine.

@erniebryant erniebryant mentioned this issue Feb 19, 2018
1 of 4 tasks complete
@fksontini
Copy link

@fksontini fksontini commented Feb 19, 2018

thanks !

@Jonas-buriti
Copy link

@Jonas-buriti Jonas-buriti commented Mar 1, 2018

I was facing the same issue, and just a npm update solved it!

@jassimkhan
Copy link

@jassimkhan jassimkhan commented Mar 15, 2018

I set the environment variable globally NODE_NO_HTTP2=1 and it worked for me.
1

@joelfmrodrigues
Copy link
Contributor

@joelfmrodrigues joelfmrodrigues commented Mar 17, 2018

All working well for me since 1.4.1 update

@saendu
Copy link

@saendu saendu commented Apr 27, 2018

Confirming this working on OSX after upgrading my project to 1.4.1! No cert issues anymore.

@akupaka
Copy link

@akupaka akupaka commented Jul 10, 2018

I have this issue on Ubuntu 18.04, node version - v8.10.0 with this packages installed

$ npm list -g -depth 0
/usr/local/lib
├── @microsoft/generator-sharepoint@1.5.1
├── gulp@3.9.1
├── npm@6.1.0
├── typescript@2.9.2
└── yo@2.0.3

NODE_NO_HTTP2=1 helped, but still.

@fabianmadurai
Copy link

@fabianmadurai fabianmadurai commented Sep 12, 2018

Dont use the latest version of Node. I ran into numerous problems using the latest version. completely uninstall node and clear the npm cache. also uninstall Yeoman and gulp. Now, install an earlier version of node ( 6.11.5 worked for me). verify with node -v that you indeed have the version you want. thereafter install yeoman and gulp and follow the hello world example and everything will work this time. even gulp serve will work.

hello world: https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/build-a-hello-world-web-part

@andrewconnell
Copy link
Collaborator

@andrewconnell andrewconnell commented Sep 13, 2018

Not sure that's the best advice. Node.js v8 works just fine with the latest versions of Yeoman (v2.0.5+), Gulp (v3.9.1) & the SPFx generator (v1.6.0. I suspect you may be having issues @fabianmadurai if you aren't on a current version of the SPFx generator. There were changes in one version that addressed issues with Node.js v8... if you are on an older version that would make sense.

@eosorioarmenta
Copy link

@eosorioarmenta eosorioarmenta commented Sep 27, 2018

linux fedora 28, with nvm nodejs v8.12.0 does not work, out of the box examples sp-dev-fx-webparts, seems like a really messy dev environment or not really cross-platform framework
It works for nvm nodejs= v6.11.5

@martinpinto
Copy link

@martinpinto martinpinto commented Oct 24, 2018

setting NODE_NO_HTTP2=1 didn't work out for me. I changed the port number on \config\serve.json and set "https" to false and then it worked out under Firefox. I am using Node v8.12.0

@andrewconnell
Copy link
Collaborator

@andrewconnell andrewconnell commented Oct 24, 2018

@martinpinto you shouldn't need to set that flag... if you are using Node v8.* & a recent version of the SPFx generator (the current version is v1.6.0), you don't need this flag.

What problem are you having & what version of the generator are you running?

@vasavidurgaprasad
Copy link

@vasavidurgaprasad vasavidurgaprasad commented Aug 12, 2019

I made NO_NODE_HTTP2 environment variable to 1. but it is not working.
I am using SPFx framework 1.8 and Node 10.16.2

@anilkuchi1 anilkuchi1 mentioned this issue Aug 15, 2019
1 of 4 tasks complete
@georgey58
Copy link

@georgey58 georgey58 commented Sep 2, 2019

I am still getting Can’t connect securely to this page running the HelloWorld example
Node version: v10.16.3
I've had tried NODE_NO_HTTP2 = 1 and setting https=false in serve.json

@brudnak
Copy link

@brudnak brudnak commented Dec 23, 2019

What a terrible experience.. SharePoint is the most maddening thing I've ever dealt with. And some people think React is hard lol...

@msft-github-bot
Copy link
Collaborator

@msft-github-bot msft-github-bot commented Jan 28, 2020

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

@SharePoint SharePoint locked as resolved and limited conversation to collaborators Jan 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet