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 :
- SPFX 1.4.1
- node 6.17.1
- npm 3.10.10
- gulp 3.9.1
- yo 2.0.6
- template @microsoft/[email protected]
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://docs.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 ?
CodePudding user response:
I am developing on SharePoint 2019 with this dev setup:
- Node v8.17.0 (this is Important)
- @microsoft/[email protected]
- [email protected]
- [email protected]
- [email protected]
Setup:
- Install Node v8.17.0
npm install [email protected] [email protected] @microsoft/[email protected] --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/