1

Issue while adding command "npm --save install office-ui-fabric-react"

enter image description here

NPM Version:

@microsoft/[email protected]

[email protected]

[email protected]

How to solve this issue?

It gives warning:[email protected] requires a peer of react@>=16.3.2-0 <17.0.0 but none was installed.

4
  • SPFx by default ships with this package, no need to install it separately. What component are you trying to use ? Commented Jun 26, 2018 at 16:34
  • I want to use checkbox component. For this i require to import from Office-Fabric UI and this folder doesn't present in Node_Modules. So, i require to use "npm --save install office-ui-fabric-react" command and it gives an error. Commented Jun 27, 2018 at 4:47
  • 1
    hey Prashant, the lastest fabric ui react is not supported with SPFx v1.0.2 because of typescript issues, so you need to install older version. Try and install npm -i [email protected] --save. Could you do that and check ? It contains the checkbox component which you can use Commented Jun 30, 2018 at 7:11
  • I solved by below Package JSON version: "@types/react": "0.14.46", I have degrade my react version. Commented Jul 2, 2018 at 6:13

1 Answer 1

0

If solution contains below package json then we can use Fabric react.

{
  "name": "navigation",
  "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.1.0",
    "@microsoft/sp-lodash-subset": "~1.1.0",
    "@microsoft/sp-office-ui-fabric-core": "~1.4.0-0",
    "@microsoft/sp-webpart-base": "~1.1.0",
    "@types/es6-promise": "0.0.33",
    "@types/react": "0.14.46",
    "@types/react-addons-shallow-compare": "0.14.17",
    "@types/react-addons-test-utils": "0.14.15",
    "@types/react-addons-update": "0.14.14",
    "@types/react-dom": "0.14.18",
    "@types/webpack-env": "1.13.1",
    "jquery": "^3.3.1",
    "react": "15.4.2",
    "react-dom": "15.4.2"
  },
  "devDependencies": {
    "@microsoft/sp-build-web": "~1.1.0",
    "@microsoft/sp-module-interfaces": "~1.1.0",
    "@microsoft/sp-webpart-workbench": "~1.1.0",
    "@types/chai": "3.4.34",
    "@types/jquery": "^2.0.48",
    "@types/mocha": "2.2.38",
    "ajv": "~5.2.2",
    "gulp": "~3.9.1"
  }
}

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.