Gulp Build fails with SPFx 1.8
Gulp build is failing with SPFx 1.8.
Below are error codes from command shell.
C:\SPFx\spfx-react-graphdemo>gulp build Build target: DEBUG [18:28:03] Using gulpfile C:\SPFx\spfx-react-graphdemo\gulpfile.js [18:28:03] Starting gulp [18:28:03] Starting 'build'... [18:28:03] Starting subtask 'configure-sp-build-rig'... [18:28:03] Finished subtask 'configure-sp-build-rig' after 6.16 ms [18:28:03] Starting subtask 'pre-copy'... [18:28:03] Finished subtask 'pre-copy' after 49 ms [18:28:03] Starting subtask 'copy-static-assets'... [18:28:03] Starting subtask 'sass'... [18:28:03] Finished subtask 'copy-static-assets' after 34 ms [18:28:03] Finished subtask 'sass' after 157 ms [18:28:03] Starting subtask 'tslint'... [18:28:04] [tslint] tslint version: 5.11.0 [18:28:04] Starting subtask 'tsc'... [18:28:04] [tsc] typescript version: 2.7.2 [18:28:09] Error - [tsc] node_modules/@uifabric/foundation/lib/ISlots.d.ts(68,124): error TS1005: ')' expected. [18:28:09] Error - [tsc] node_modules/@uifabric/foundation/lib/ISlots.d.ts(68,177): error TS1005: '(' expected. [18:28:09] Error - [tsc] node_modules/@uifabric/foundation/lib/ISlots.d.ts(68,185): error TS1005: ':' expected. [18:28:09] Error - [tsc] node_modules/@uifabric/merge-styles/lib/IStyleSet.d.ts(18,67): error TS1005: ';' expected. [18:28:09] Error - [tsc] node_modules/@uifabric/merge-styles/lib/IStyleSet.d.ts(18,114): error TS1005: '(' expected. [18:28:09] Error - [tsc] node_modules/@uifabric/merge-styles/lib/IStyleSet.d.ts(18,136): error TS1005: '(' expected. [18:28:09] Error - 'tsc' sub task errored after 4.81 s exited with code 2 [18:28:09] 'build' errored after 5.63 s [18:28:09] [18:28:09] Finished subtask 'tslint' after 5.85 s [18:28:09] ==================[ Finished ]================== Error - [tsc] node_modules/@uifabric/foundation/lib/ISlots.d.ts(68,124): error TS1005: ')' expected. Error - [tsc] node_modules/@uifabric/foundation/lib/ISlots.d.ts(68,177): error TS1005: '(' expected. Error - [tsc] node_modules/@uifabric/foundation/lib/ISlots.d.ts(68,185): error TS1005: ':' expected. Error - [tsc] node_modules/@uifabric/merge-styles/lib/IStyleSet.d.ts(18,67): error TS1005: ';' expected. Error - [tsc] node_modules/@uifabric/merge-styles/lib/IStyleSet.d.ts(18,114): error TS1005: '(' expected. Error - [tsc] node_modules/@uifabric/merge-styles/lib/IStyleSet.d.ts(18,136): error TS1005: '(' expected. Error - 'tsc' sub task errored after 4.81 s exited with code 2 [18:28:10] Project spfx-react-graphdemo version:0.0.1 [18:28:10] Build tools version:3.9.7 [18:28:10] Node version:v10.16.0 [18:28:10] Total duration:10 s [18:28:10] Task errors:7
C:\SPFx\spfx-react-graphdemo>
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
Chances are you don't have an explicit reference to officeui-fabric-react in your package.json file, but you are using it in your source code. Make sure you are referencing the version of OUIFR in package.json that you want to use in your solution.
@patmill I found reference was missing, so I added but still no luck. I am attaching package.json.
Project in subject I scaffold using @microsoft/[email protected] [email protected]
** package.json*** { "name": "spfx-react-graphdemo", "version": "0.0.1", "private": true, "engines": { "node": ">=0.10.0" }, "scripts": { "build": "gulp bundle", "clean": "gulp clean", "test": "gulp test" }, "dependencies": { "@microsoft/sp-core-library": "1.8.0", "@microsoft/sp-lodash-subset": "1.8.0", "@microsoft/sp-office-ui-fabric-core": "1.8.0", "@microsoft/sp-property-pane": "1.8.0", "@microsoft/sp-webpart-base": "1.8.0", "@types/es6-promise": "0.0.33", "@types/react": "16.4.2", "@types/react-dom": "16.0.5", "@types/webpack-env": "1.13.1", "office-ui-fabric-react": "^6.188.0", "react": "16.7.0", "react-dom": "16.7.0" }, "resolutions": { "@types/react": "16.4.2" }, "devDependencies": { "@microsoft/sp-build-web": "1.8.0", "@microsoft/sp-tslint-rules": "1.8.0", "@microsoft/sp-module-interfaces": "1.8.0", "@microsoft/sp-webpart-workbench": "1.8.0", "@microsoft/rush-stack-compiler-2.7": "0.4.0", "gulp": "~3.9.1", "@types/chai": "3.4.34", "@types/mocha": "2.2.38", "ajv": "~5.2.2" } }
gulp build command produces following error:
C:\SPFx\spfx-react-graphdemo>gulp build Build target: DEBUG [09:36:42] Using gulpfile C:\SPFx\spfx-react-graphdemo\gulpfile.js [09:36:42] Starting gulp [09:36:42] Starting 'build'... [09:36:42] Starting subtask 'configure-sp-build-rig'... [09:36:42] Finished subtask 'configure-sp-build-rig' after 6.24 ms [09:36:42] Starting subtask 'pre-copy'... [09:36:42] Finished subtask 'pre-copy' after 49 ms [09:36:42] Starting subtask 'copy-static-assets'... [09:36:42] Starting subtask 'sass'... [09:36:42] Finished subtask 'copy-static-assets' after 35 ms [09:36:42] Finished subtask 'sass' after 163 ms [09:36:42] Starting subtask 'tslint'... [09:36:42] [tslint] tslint version: 5.11.0 [09:36:42] Starting subtask 'tsc'... [09:36:42] [tsc] typescript version: 2.7.2 [09:36:48] Error - [tsc] node_modules/@uifabric/foundation/lib/ISlots.d.ts(68,124): error TS1005: ')' expected. [09:36:48] Error - [tsc] node_modules/@uifabric/foundation/lib/ISlots.d.ts(68,177): error TS1005: '(' expected. [09:36:48] Error - [tsc] node_modules/@uifabric/foundation/lib/ISlots.d.ts(68,185): error TS1005: ':' expected. [09:36:48] Error - [tsc] node_modules/@uifabric/merge-styles/lib/IStyleSet.d.ts(18,67): error TS1005: ';' expected. [09:36:48] Error - [tsc] node_modules/@uifabric/merge-styles/lib/IStyleSet.d.ts(18,114): error TS1005: '(' expected. [09:36:48] Error - [tsc] node_modules/@uifabric/merge-styles/lib/IStyleSet.d.ts(18,136): error TS1005: '(' expected. [09:36:48] Error - 'tsc' sub task errored after 5.08 s exited with code 2 [09:36:48] 'build' errored after 5.93 s [09:36:48] [09:36:48] ==================[ Finished ]================== Error - [tsc] node_modules/@uifabric/foundation/lib/ISlots.d.ts(68,124): error TS1005: ')' expected. Error - [tsc] node_modules/@uifabric/foundation/lib/ISlots.d.ts(68,177): error TS1005: '(' expected. Error - [tsc] node_modules/@uifabric/foundation/lib/ISlots.d.ts(68,185): error TS1005: ':' expected. Error - [tsc] node_modules/@uifabric/merge-styles/lib/IStyleSet.d.ts(18,67): error TS1005: ';' expected. Error - [tsc] node_modules/@uifabric/merge-styles/lib/IStyleSet.d.ts(18,114): error TS1005: '(' expected. Error - [tsc] node_modules/@uifabric/merge-styles/lib/IStyleSet.d.ts(18,136): error TS1005: '(' expected. Error - 'tsc' sub task errored after 5.08 s exited with code 2 [09:36:48] Finished subtask 'tslint' after 6.25 s [09:36:49] Project spfx-react-graphdemo version:0.0.1 [09:36:49] Build tools version:3.9.7 [09:36:49] Node version:v10.16.0 [09:36:49] Total duration:10 s [09:36:49] Task errors:7
C:\SPFx\spfx-react-graphdemo>
Fabric react 6.x requires typescript 2.9 or later. Easiest thing to do is bump your generator up to 1.8.2. Otherwise, you can use fabric react 5, or rush-stack-compiler-2.9. Again - easiest thing to do is use 1.8.2 - when you choose a react project, we'll use ouifr 6 and an appropriate rush-stack-compiler / typescript version.
Thanks @patmill using 1.8.2 generator solves my issue. Now I see a OUIFR reference in package.json which I manually added previously with 1.8.0. Only question out of curiosity, can I change typescript version in tsconfig.json file ?
Thanks
You need to do a couple of things. The 1.8.0 release notes discuss it, but this blog post from Elio is probably more explicit.
https://www.eliostruyf.com/define-the-typescript-version-you-want-to-use-in-sharepoint-framework/
Thanks @patmill @andrewconnell
Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues