|
| 1 | +--- |
| 2 | +title: SharePoint Framework development with SharePoint Server 2019 and Subscription Edition |
| 3 | + |
| 4 | +description: SharePoint Server 2019 & Subscription Edition (SE) supports SharePoint Framework client-side web parts in classic and modern pages, and extensions in modern pages. |
| 5 | +ms.date: 03/22/2023 |
| 6 | +ms.localizationpriority: high |
| 7 | +--- |
| 8 | + |
| 9 | +# SharePoint Framework development with SharePoint Server 2019 and Subscription Edition |
| 10 | + |
| 11 | +SharePoint Server 2019 and Subscription Edition support SharePoint Framework client-side web parts in classic and modern pages, and extensions in modern pages. |
| 12 | + |
| 13 | +> [!IMPORTANT] |
| 14 | +> SharePoint Server Subscription Edition (SE) has all the same dependencies and requirements for the SharePoint Framework as SharePoint Server 2019. |
| 15 | +
|
| 16 | + |
| 17 | +## Which version of the SharePoint Framework to use |
| 18 | + |
| 19 | +Because SharePoint Online and SharePoint Server 2019 have different release cycles for new capabilities, they also have different capabilities when it comes to the SharePoint Framework. SharePoint Online always uses the latest version of the SharePoint Framework, but SharePoint Server 2019 only supports the version that matches the server-side dependencies of the deployed packages. |
| 20 | + |
| 21 | +> [!IMPORTANT] |
| 22 | +> SharePoint Server 2019 supports SharePoint Framework client-side web parts hosted on classic or modern SharePoint pages built by using the SharePoint Framework v1.4.1. |
| 23 | +
|
| 24 | +SharePoint Server 2019 also supports SharePoint Framework extensions hosted on modern SharePoint pages built using SharePoint Framework v1.4.1. This means that when you're targeting the SharePoint Server 2019 platform, you need to use the SharePoint Framework v1.4.1 because of the server-side version dependencies. |
| 25 | + |
| 26 | +Starting from v1.3, the SharePoint Framework Yeoman generator supports scaffolding solutions that use both the latest version of the SharePoint Framework meant for use with SharePoint Online, and solutions that can be used with SharePoint on-premises based on the v1.1.0 or v1.4.1 of the SharePoint Framework. You don't need to install a separate version of the SharePoint Framework Yeoman generator to scaffold solutions meant for use with SharePoint on-premises. |
| 27 | + |
| 28 | +## Development environment considerations |
| 29 | + |
| 30 | +When you're developing SharePoint Framework client-side web parts, you need Internet connectivity to access npm packages. This is required when solutions are being scaffolded by using the SharePoint Framework Yeoman templates. |
| 31 | + |
| 32 | +If Internet access isn't available for the development machines, you can set up a local on-premises registry for the required npm packages. However, this requires more software and a significant amount of work to set up and maintain local package versions with packages in the actual npm gallery. |
| 33 | + |
| 34 | +The [Team-based development on the SharePoint Framework](team-based-development-on-sharepoint-framework.md) guidance document includes different options for development environment setup including when you might need to support multiple SharePoint Framework versions. |
| 35 | + |
| 36 | +### Node.js, gulp-cli, and Yeoman versions |
| 37 | + |
| 38 | +The dependencies for SPFx v1.4.1 frameworks, tools, and the associated versions don't match the same dependency matrix for the latest versions of SharePoint Framework. In these cases, you may need to install specific versions of the tools. Because SPFx v1.4.1 is supported on Node.js v6 and Node.js v8 by default, you need to ensure you have a supported version of Node.js installed as well as an older version of Gulp CLI and Yeoman. |
| 39 | + |
| 40 | +> [!NOTE] |
| 41 | +> - The Gulp team introduced a separate package, [gulp-cli](https://www.npmjs.com/package/gulp-cli), that should be installed globally. It can be used by projects that use either Gulp v3 & Gulp v4. |
| 42 | +> - Learn more about the gulp-cli here: [gulpjs/gulp/#2324](https://github.com/gulpjs/gulp/issues/2324). |
| 43 | +
|
| 44 | +Microsoft recommends using the most recent version of the Yeoman generator for the SharePoint Framework [@microsoft/generator-sharepoint](https://www.npmjs.com/package/@microsoft/generator-sharepoint) that supports creating on-premises projects: SPFx v1.10.0. |
| 45 | + |
| 46 | +> [!IMPORTANT] |
| 47 | +> The Yeoman generator for the SharePoint Framework, starting with v1.13.0, only supports projects for SharePoint Online. Learn more about this change in the [SharePoint Framework v1.13 release notes](release-1.13.md). However, SPFx 1.4.1 is supported on Node.js v6 and Node.js v8 by default. Therefore, you need to get the latest version of the Yeoman generator for the SharePoint Framework (v1.10.0) that works on the same version of Node.js (v6 or v8) that SPFx v1.4.1 is supported on. Solution structure is created then with the v1.4.1 version packages as long as you select the environmen target properly in the Yeoman generator flow. |
| 48 | +
|
| 49 | +### Prepare the environment for SharePoint Framework development |
| 50 | + |
| 51 | +1. Install [Node.js v8.17.0](https://nodejs.org/download/release/v8.17.0/). |
| 52 | + |
| 53 | + SPFx v1.4.1 is also supported on Node.js v12 and v14 (v12.18.1 and v14.17.1 to be specific), although there is an incompatible issue [gulp 3 wasn't compatible with Node 12+](https://github.com/gulpjs/gulp/issues/2324). The workaround to resolve this issue is to specify the version of graceful-fs component as 4+. You can create npm-shrinkwrap.json in the root folder of the project and input the following content, and then run “npm install”. Also, you can use package-lock.json to resolve this issue too. |
| 54 | + |
| 55 | + ```powershell |
| 56 | + { |
| 57 | +
|
| 58 | + “dependencies”:{ |
| 59 | + “graceful-fs”: { |
| 60 | + “version”: “4.2.2” |
| 61 | + } |
| 62 | + } |
| 63 | + } |
| 64 | + ``` |
| 65 | +
|
| 66 | +1. Install global dependencies |
| 67 | +
|
| 68 | + ```console |
| 69 | + npm install [email protected] --global |
| 70 | + npm install [email protected] --global |
| 71 | + npm install @microsoft/[email protected] --global |
| 72 | + ``` |
| 73 | +
|
| 74 | +For more information, see [SharePoint Framework development tools and libraries compatibility](tools-and-libraries.md). |
| 75 | +
|
| 76 | +## Build and deploy your first web part with SharePoint Framework |
| 77 | +
|
| 78 | +To create a new web part with SharePoint Framework, see [Build your first SharePoint client-side web part](web-parts/get-started/build-a-hello-world-web-part.md). |
| 79 | +
|
| 80 | +To deploy your web part to SharePoint on-premises, unlike deploying to SharePoint Online, some dependent service applications and specific configurations on the SharePoint Server are required. You can contact SharePoint Server administrator if you do not have appropriate permission to check or configure. |
| 81 | +
|
| 82 | +1. Ensure App Management Service and other dependent service applications are configured, see [Configure an environment for apps for SharePoint Server](/sharepoint/administration/configure-an-environment-for-apps-for-sharepoint). |
| 83 | +1. Create and configure App Catalog site, see [Manage the App Catalog in SharePoint Server](/sharepoint/administration/manage-the-app-catalog). |
| 84 | +1. Package and upload your web part, install it on your site, and add it to modern page, see [Deploy your client-side web part to a SharePoint page](web-parts/get-started/serve-your-web-part-in-a-sharepoint-page.md). |
| 85 | +
|
| 86 | +## Determine which version was used for a solution |
| 87 | +
|
| 88 | +If you have existing SharePoint Framework solutions and you'd like to confirm which version of the SharePoint Framework was used for them, you'll need to check the following locations: |
| 89 | +
|
| 90 | +- **.yo-rc.json**: File in the solution's root folder that stores the SharePoint Framework Yeoman template version used when the solution was created. |
| 91 | +- **package.json**: File in the solution's root folder that contains references to package versions used in the solution. |
| 92 | +- **npm-shrinkwrap.json**: File in the solution's root folder that contains information about the exact versions used (if you used the `npm shrinkwrap` command to lock down the exact versions of the solution). |
| 93 | +- **package.json**: File in the **node_modules/@microsoft/sp-webpart-base** folder that contains a `version` attribute matching the used SharePoint Framework version, if you have installed packages to your solution. |
| 94 | +
|
| 95 | +## Troubleshooting |
| 96 | +
|
| 97 | +### Impact of Node.js v6, Node.js v8, HTTP1, & HTTP2 |
| 98 | +
|
| 99 | +Around this the time of the v1.1 release, Node.js was transitioning from Node.js v6.x to v8.x. In this update, Node.js introduced a change where the default HTTP protocol switched from HTTP1 to HTTP2. SPFx v1.1 was written for HTTP1, not HTTP2, so this change affected the local web server for SPFx v1.1 projects. |
| 100 | +
|
| 101 | +In Node.js v8.x, you can force HTTP1 by setting the following environment variable to instruct Node.js to use HTTP1 instead of the default HTTP2: `NODE_NO_HTTP2=1`. This environment variable only exists in Node.js v8.x. That's why if you're building SPFx solutions for SharePoint Server 2016, you should use Node.js v8.x. |
| 102 | +
|
| 103 | +This issue doesn't impact later versions of SPFx because they've been updated to support HTTPs. |
| 104 | +
|
| 105 | +For more information, see [issue #1002](https://github.com/SharePoint/sp-dev-docs/issues/1002). |
| 106 | +
|
| 107 | +## See also |
| 108 | +
|
| 109 | +- [SharePoint Framework Overview](sharepoint-framework-overview.md). |
| 110 | +- [SharePoint Server 2019 development platform](../general-development/sharepoint-2019-development-platform.md). |
| 111 | +- [Definitive guide for developers: SharePoint Framework for SharePoint Server 2019](https://www.voitanos.io/blog/definitive-guide-sharepoint-framework-sharepoint-server-2019/). |
| 112 | +- [Definitive guide for developers: SharePoint Framework for SharePoint Server SE](https://www.voitanos.io/blog/definitive-guide-sharepoint-framework-sharepoint-server-subscription-edition/). |
0 commit comments