0

I am trying to build SPFX(React Framework) with Fluent UI. I am not able import any Fluent UI components. VS code failed to build with error : Cannot find module '@fluentui/react' enter image description here

4
  • Have you tried npm i @fluentui/react-components Commented Aug 23, 2022 at 22:41
  • Which version of SPFx / Node.js are you using? Also, try running npm i @fluentui/react command before building the web part. Let us know if it works. Commented Aug 24, 2022 at 4:02
  • Node JS is 10.24(as per Microsoft recommendation) Commented Aug 24, 2022 at 8:08
  • @Saira Yes, It had already done Commented Aug 24, 2022 at 8:16

3 Answers 3

1

Please run below cmdlet

npm install @fluentui/react 

And you will get following enter image description here

1
  • I had this added already..but did not work. Commented Aug 24, 2022 at 8:07
0

Install "office-ui-fabric-react": "^6.189.2" and use 'office-ui-fabric-react" instead of '@fluentui/react'

2
  • I need to use Fluent UI. Commented Aug 24, 2022 at 8:09
  • Fabric ui is same as fluent ui but an older version Commented Aug 25, 2022 at 9:02
0

This is a limitation of SPFx v1.4.1. Solution generator referenced to older version of packages which not compatible with FluentUI (you have to use office-ui-fabric-core). Below definitive guide describes it well.

Definitive Guide:

https://www.voitanos.io/blog/definitive-guide-sharepoint-framework-sharepoint-server-2019/

Workaround to use FluentUI in SPFX 1.4.1:

https://www.c-sharpcorner.com/article/build-sharepoint-framework-solutions-for-on-premise-sharepoint-server-2019/

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.