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
    – Saira
    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. Aug 24, 2022 at 4:02
  • Node JS is 10.24(as per Microsoft recommendation)
    – mzonerz
    Aug 24, 2022 at 8:08
  • @Saira Yes, It had already done
    – mzonerz
    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.
    – mzonerz
    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'

3
  • I need to use Fluent UI.
    – mzonerz
    Aug 24, 2022 at 8:09
  • Fabric ui is same as fluent ui but an older version Aug 25, 2022 at 9:02
  • thats why I dont want to use. thank you :)
    – mzonerz
    Aug 25, 2022 at 10:49
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/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.