I need to create an SPFx web part for SharePoint 2016. I have been following the instructions here but am getting an error when running "yo @microsoft/sharepoint".
I know that versions of packages really matter, so let me describe those:
- node v8.17.0 (using nvm)
- @microsoft/[email protected] (globally installed)
- [email protected] (globally installed)
- [email protected] (globally installed)
- [email protected] (globally installed)
After having trouble the first time, I tried my best to replicate everything Vesa had in the video at the link further above. Everything is exactly as his versions show except he doesn't mention his version of node. I read that it had to be 8.x for SP2016 web parts, so I chose the latest 8.x version (8.17.0).
Getting npm to use 3.10.10 was actually a little bit of work best described here.
When running "yo @microsoft/sharepoint" I chose "No JavaScript web framework" just to keep things simple (although I want React). The first error I get is the following (there are a few other errors after this one).
Downloading binary from https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-57_binding.node Cannot download "https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-57_binding.node":
HTTP error 404 Not Found
Going to that web page they clearly don't keep versions that old. Is there any recommended set of versions for node and npm packages I should use? Are there workarounds I should be using instead to fix this specific issue?
For attempt #2 (I'll call it #2, but I really tried a few before the one above), I went up to 1.1 on SPFx:
- node v8.17.0 (using nvm)
- @microsoft/generator-sharepoint@1.1.0 (globally installed)
- [email protected] (globally installed)
- [email protected] (globally installed)
- [email protected] (globally installed)
I got the same initial error as attempt #1 (I didn't look to see if the errors after that matched).
For attempt #3 I went down to 6.x on node:
- node v6.17.1 (using nvm)
- @microsoft/[email protected] (globally installed)
- [email protected] (globally installed)
- [email protected] (globally installed)
- [email protected] (globally installed)
This time the error (and only output) for "yo @microsoft/sharepoint" was:
C:\Users\Kirk\AppData\Roaming\nvm\v6.17.1\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\Kirk\AppData\Roaming\nvm\v6.17.1\node_modules\yo\lib\router.js:9:54)