Skip to content

Commit e3ace24

Browse files
Merge pull request SharePoint#9199 from WesleyFive/spfx-onprem-1
Update SPFx dev guidance of SP19 & SPSE to support Node 16
2 parents 353b36d + 33d95e8 commit e3ace24

File tree

1 file changed

+22
-12
lines changed

1 file changed

+22
-12
lines changed

docs/spfx/sharepoint-2019-and-subscription-edition-support.md

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ms.localizationpriority: high
1010
SharePoint Server 2019 and Subscription Edition support SharePoint Framework client-side web parts in classic and modern pages, and extensions in modern pages.
1111

1212
> [!IMPORTANT]
13-
> SharePoint Server Subscription Edition (SE) has all the same dependencies and requirements for the SharePoint Framework as SharePoint Server 2019.
13+
> SharePoint Server Subscription Edition (SE) has all the same dependencies and requirements for the SharePoint Framework (SPFx) as SharePoint Server 2019.
1414
1515
## Which version of the SharePoint Framework to use
1616

@@ -49,16 +49,26 @@ Microsoft recommends using the most recent version of the Yeoman generator for t
4949

5050
1. Install [Node.js v8.17.0](https://nodejs.org/download/release/v8.17.0/).
5151

52-
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's 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.
53-
54-
```json
55-
{
56-
“dependencies”: {
57-
“graceful-fs”: {
58-
“version”: “4.2.2”
59-
}
60-
}
52+
SPFx v1.4.1 is also supported on Node.js v12, v14 and v16 (v12.18.1, v14.17.1 and v16.15.0 to be specific), though there are incompatible issues ([gulp v3 is incompatible with Node v12+](https://github.com/gulpjs/gulp/issues/2324), and **node-sass** v4 requires Node.js v14 or below). The workaround to resolve them is to specify the version of the **graceful-fs** component as v4+, and to replace **node-sass** with **sass**. You can manually modify **package-lock.json** or **npm-shrinkwrap.json** and then re-run `npm install`. Or you can create a new **\*.js** file located in the root folder of your project, copy the following code into that file, run `node your_new_js_file` and re-run `npm install`.
53+
54+
```JavaScript
55+
const fs = require('fs');
56+
const lockedVersionFile = 'package-lock.json';
57+
// const lockedVersionFile = 'npm-shrinkwrap.json';
58+
const lockedVersionJson = JSON.parse(fs.readFileSync(lockedVersionFile));
59+
if (lockedVersionJson.packages) {
60+
const vinylFSJson = lockedVersionJson.packages["node_modules/vinyl-fs"];
61+
if (vinylFSJson && vinylFSJson["dependencies"] && vinylFSJson["dependencies"]["graceful-fs"]) {
62+
vinylFSJson["dependencies"]["graceful-fs"] = "npm:[email protected]";
63+
}
64+
65+
const gulpSassJson = lockedVersionJson.packages["node_modules/gulp-sass"];
66+
console.log(gulpSassJson);
67+
if (gulpSassJson && gulpSassJson["dependencies"] && gulpSassJson["dependencies"]["node-sass"]) {
68+
gulpSassJson["dependencies"]["node-sass"] = "npm:[email protected]";
69+
}
6170
}
71+
fs.writeFileSync(lockedVersionFile, JSON.stringify(lockedVersionJson, undefined, 2));
6272
```
6373

6474
1. Install global dependencies
@@ -75,7 +85,7 @@ For more information, see  [SharePoint Framework development tools and librari
7585

7686
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).
7787

78-
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 don't have appropriate permission to check or configure.
88+
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 the SharePoint Server administrator if you don't have appropriate permission to check or configure.
7989
8090
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).
8191
1. Create and configure App Catalog site, see [Manage the App Catalog in SharePoint Server](/sharepoint/administration/manage-the-app-catalog).
@@ -94,7 +104,7 @@ If you have existing SharePoint Framework solutions and you'd like to confirm wh
94104

95105
### Impact of Node.js v6, Node.js v8, HTTP1, & HTTP2
96106

97-
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.
107+
Around 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.
98108

99109
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.
100110

0 commit comments

Comments
 (0)