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 · 30 comments

Comments

Projects
None yet
@waldekmastykarz
Member

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

This comment has been minimized.

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

This comment has been minimized.

Member

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

This comment has been minimized.

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

This comment has been minimized.

Member

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

This comment has been minimized.

Member

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

This comment has been minimized.

Mike-tech commented Nov 3, 2017

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

image

@iclanton

This comment has been minimized.

Contributor

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

This comment has been minimized.

Member

waldekmastykarz commented Nov 3, 2017

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

@Mike-tech

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

casvaniersel commented Jan 9, 2018

Saved the day dude :) thanks @waldekmastykarz !

@HeToC

This comment has been minimized.

HeToC commented Jan 12, 2018

does not work for me on my mac
nodejs v 9.4.0

@andrewconnell andrewconnell referenced this issue Jan 15, 2018

Closed

Workbench wont even load #1241

1 of 1 task complete
@lifayt

This comment has been minimized.

lifayt commented Feb 2, 2018

Echoed - this does not solve the issue on Mac.

@andrewconnell

This comment has been minimized.

Collaborator

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

This comment has been minimized.

lifayt commented Feb 2, 2018

Cheers, thank you!

@pankajsurti

This comment has been minimized.

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

This comment has been minimized.

Collaborator

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

This comment has been minimized.

Collaborator

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-msft nickpape-msft referenced this issue Feb 16, 2018

Closed

SPFX Local workbench not loading #1256

0 of 4 tasks complete
@btastic

This comment has been minimized.

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 referenced this issue Feb 19, 2018

Closed

Local Workbench SSL issue with node 9.0.0 #1379

1 of 4 tasks complete
@fksontini

This comment has been minimized.

fksontini commented Feb 19, 2018

thanks !

@Jonas-buriti

This comment has been minimized.

Jonas-buriti commented Mar 1, 2018

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

@jassimkhan

This comment has been minimized.

jassimkhan commented Mar 15, 2018

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

@joelfmrodrigues

This comment has been minimized.

Contributor

joelfmrodrigues commented Mar 17, 2018

All working well for me since 1.4.1 update

@saendu

This comment has been minimized.

saendu commented Apr 27, 2018

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

@akupaka

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Collaborator

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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Collaborator

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment