11

Reading the SPFx documentation I find it difficult to understand which service/tool/framework handles requests as a web server. From documentation both Node and Gulp can be used as a web server during development.

Abstracting tools

Node is a runtime which makes me think it's close to CLR on Windows machines. Gulp on the other hand is a task runner which makes me think it's an IIS website or its application pool. If I start gulp serve I can access my webpart in localhost. If I stop it, I can't.

Does Node or Gulp act as webserver during webpart development?

1
  • 1
    What comes down the pipe with @microsoft/sp-build-web? (I haven't checked) Gulp runs on top of Node, so Node is always involved. There are multiple webserver/live reload solutions available.. or MS built one themselves because of SP specific requirements. Commented Aug 28, 2016 at 8:24

3 Answers 3

8

Neither Gulp or Node act as the web server. The web server used for SPFx is Connect, see below.

These are (some of) the different moving parts in the SPFx workbench

  • Node.js: is the JavaScript runtime, using Chrome V8 JavaScript engine (could be compared to .NET CLR)
  • Gulp: is a build system for Node.js (also known as a task runner)
  • Gulp-connect: is a Gulp task using the Connect web server
  • Connect: is a http server for Node.js
5

SPFx uses a Gulp plugin called Gulp connect to start the webserver hosting the Workbench.

You're right saying that Gulp is a task-runner. In a way you could compare it MSBuild in .NET development. Also your comparison of Node to CLR is correct in the context of SPFx.

-1

Node is the underlying server module for #spfx, so install node first and make sure its path is included in the system path.

I then created a windows command file (CMD) with the following contents an called it: installs.cmd


    call npm uninstall -g chalk
    call npm uninstall -g loadash
    call npm uninstall -g tar-fs
    call npm uninstall -g update-notifier
    call npm uninstall -g yeoman-generator
    call npm uninstall -g yosay
    call npm uninstall -g yo
    call npm uninstall -g gulp
    call npm uninstall -g @microsoft/generator-sharepoint

    call npm install -g chalk
    call npm install -g loadash
    call npm install -g tar-fs
    call npm install -g update-notifier
    call npm install -g yeoman-generator
    call npm install -g yosay
    call npm install -g yo
    call npm install -g gulp

    call npm install -g @microsoft/generator-sharepoint

after this cmd runs, the you can type: yo @microsoft/generator-sharepoint to create your webpart....

Cheers,

1
  • This does not really answer the question asked at all Commented Sep 4, 2016 at 17:41

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.