npmsharepointgulpyeomanspfx

SharePoint 2019 On Premise spfx js dev setup. which tools versions to serve helloworld?


I am trying to set a development environment in order to code spfx webparts targeting SP2019 on premise sites.

After following the Microsoft documentation - including the almost hidden pages regarding whatever is not online - I came up with the folowing versions of the various tools :

I obviouly missed something since after installing globaly : node > gulp > gulp-cli > yo I am unable to run yo. It throws

C:\Users\login\AppData\Roaming\npm\node_modules\yo\node_modules\yeoman-environment\lib\environment.js:154
      options = {singleResult: !options.multiple, ...options};
                                                  ^^^

SyntaxError: Unexpected token ...
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:549:28)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)
    at Function.Module._load (module.js:445:3)
    at Module.require (module.js:504:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\login\AppData\Roaming\npm\node_modules\yo\lib\router.js:9:27)

It must be my third attempt to find the right versions since I first followed the article https://learn.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-development-environment which starts by telling us to install the last LTS version of node before sending us to other pages at the bottom of the article to tell us in a convoluted whay that the last compatible version an old one. So I uninstalled, removed the appdata folders and temp trash left after uninstalling (great automation tools)

Is anyone around able to do list the versions and the order of installation required to create a webpart solution for SharePoint 2019 on premise ?


Solution

  • I am developing on SharePoint 2019 with this dev setup:

    Setup:

    1. Install Node v8.17.0
    2. npm install gulp-cli@2.3.0 yo@3.1.1 @microsoft/generator-sharepoint@1.10.0 --global

    If you are developing also on SharePoint online my recommendation is to use nvm (node version manager), which allows to use different versions of Node. https://heynode.com/tutorial/install-nodejs-locally-nvm/