sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

Cannot add webpart built with Framework version 1.8

Open promisetochi opened this issue 7 years ago • 11 comments

Category

  • [ ] Question
  • [ ] Typo
  • [x] Bug
  • [ ] Additional article idea

Expected or Desired Behavior

Observed Behavior

I have just upgraded to framework version 1.8 and I've built and deployed the solution. When I try to add the webpart to the page, I get this error

Original error: Error loading https://component-id.invalid/f2f8e00f-ef2a-4909-b24a-818262f88a19_0.0.1
	D.createContext is not a function

Built with React 16.7.0 and React-dom 16.7.0

Would appreciate any quick response or help 🙏

promisetochi avatar Mar 15 '19 22:03 promisetochi

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

msft-github-bot avatar Mar 15 '19 22:03 msft-github-bot

Where are you trying to deploy this?

patmill avatar Mar 16 '19 03:03 patmill

@patmill thanks for looking at this. I meant I uploaded the ppkg file to app catalog and deployed it. We host the customizer and webpart js files on Amazon's cdn. This is the same way we've been using the webpart with framework 1.4.1 but because we are using loadTheme and it has recently been causing issues, we have to upgrade urgently.

promisetochi avatar Mar 16 '19 07:03 promisetochi

Sorry - I meant what the target version of SharePoint. Are you deploying to on-prem, or to O365?

patmill avatar Mar 18 '19 01:03 patmill

@patmill it's SharePoint online on office 365

promisetochi avatar Mar 18 '19 08:03 promisetochi

OK, someone trying to upgrade an existing project ran into this today as well. The problem was a mix of missing package.json entries, pointers to the wrong pnp/* projects, and code that was referencing OUIFR w/o importing it into package.json. We got it sorted out, so we should be able to do the same thing here.

Can you paste your package.json here, and search through your source code in /src for references to office-ui-fabric-react ?

patmill avatar Mar 18 '19 17:03 patmill

@patmill thanks, here's the content of package.json

{
  "name": "shortpoint-spfx",
  "version": "0.0.1",
  "private": true,
  "engines": {
    "node": ">=0.10.0"
  },
  "scripts": {
    "build": "gulp bundle",
    "clean": "gulp clean",
    "test": "gulp test"
  },
  "dependencies": {
    "@microsoft/decorators": "~1.8.0",
    "@microsoft/sp-application-base": "~1.8.0",
    "@microsoft/sp-core-library": "~1.8.0",
    "@microsoft/sp-dialog": "~1.8.0",
    "@microsoft/sp-lodash-subset": "~1.8.0",
    "@microsoft/sp-office-ui-fabric-core": "~1.8.0",
    "@microsoft/sp-webpart-base": "^1.8.0",
    "@types/knockout": "3.4.39",
    "@types/react": "^16.8.8",
    "@types/react-addons-shallow-compare": "~0.14.22",
    "@types/react-addons-test-utils": "~0.14.24",
    "@types/react-addons-update": "~0.14.20",
    "@types/react-dom": "^16.8.2",
    "@types/webpack-env": ">=1.12.1 <1.14.0",
    "knockout": "3.4.0",
    "react": "16.7.0",
    "react-dom": "16.7.0"
  },
  "devDependencies": {
    "@microsoft/sp-build-web": "~1.8.0",
    "@microsoft/sp-module-interfaces": "~1.8.0",
    "@microsoft/sp-webpart-workbench": "~1.8.0",
    "@types/chai": ">=3.4.34 <3.6.0",
    "@types/mocha": ">=2.2.33 <2.6.0",
    "ajv": "~5.2.2",
    "gulp": "^3.9.1",
    "uglifyjs-webpack-plugin": "^1.2.5",
    "@microsoft/sp-tslint-rules": "1.8.0",
    "@microsoft/rush-stack-compiler-3.2": "0.2.6"
  }
}

promisetochi avatar Mar 21 '19 10:03 promisetochi

Any update on this?

enail131 avatar Mar 27 '19 16:03 enail131

One thing that looks a bit suspicious is the react typings point at 16..8.8. Can you try them at 16.7.22 ? I wonder if you are trying to call a method that doesn't exist on the underlying object, since it is loading react 16.7

patmill avatar Mar 27 '19 16:03 patmill

@patmill thanks. I couldn't reproduce this issue after changing the versions for react typings

promisetochi avatar Apr 12 '19 15:04 promisetochi

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

msft-github-bot avatar Jan 25 '20 00:01 msft-github-bot