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

Error deploying web part to a SharePoint page

Open joselarios opened this issue 9 years ago • 8 comments

Hello,

Category

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

Expected or Desired Behavior

Web part loads on SharePoint page, accessing assets from Sharepoint Site Assets list.

Observed Behavior

Web part does not load, received error message indicating failure to load JSON asset. Exact error message:

***ERROR MESSAGE:

***Failed to load component "5b4b0e26-5361-4b19-95b0-3f088bd39d6f" (ThinkQuestionWebPart).

Original error: ***Failed to load entry point from component "5b4b0e26-5361-4b19-95b0-3f088bd39d6f" (ThinkQuestionWebPart).

Original error: Error loading https://component-id.invalid/5b4b0e26-5361-4b19-95b0-3f088bd39d6f_0.0.1 t.module(...).info is not a function

***CALLSTACK:

i/<@https://spoprod-a.akamaihd.net/files/sp-client-prod_2017-06-02.014/classic-pages-assembly_en-us_d99e510cc09bbeb6a454a0ee800b4d78.js:109:200964

Steps to Reproduce

  1. Create new GA drop web part with latest AngularJS (v1.x).
  2. Create Site Assets list in SharePoint. Open write-manifests.json file in web part and enter in URL to Site Assets for the cdnBasePath property.
  3. Run "gulp bundle --ship"
  4. Run "gulp package-solution --ship"
  5. Navigate to ./temp/deploy folder in web part. Take the files inside and upload them to the SharePoint's Site Assets.
  6. Upload or drag & drop the newly created client-side solution package to the app catalog in your tenant. Choose "Deploy" on pop-up window.
  7. Open a site where you want to test the web part and go the Site contents page of the site. Choose Add – App from the toolbar and choose the sphosted-webpart-client-side-solution app to be installed on the site.
  8. After the solution has been installed, navigate to the page you wish to add the web part to, then add web part.
  9. Error message is received.

Additional Info

  • From the network traffic, we are able to see that of the 3 asset files generated from "gulp bundle --ship", 2 are being loaded with no errors, but the JSON file is not.

  • We are attempting to load the web part on a SharePoint classic page.

  • Loading an AngularJS web part's assets from within a SharePoint Site Assets list was working in a previous SPFX drop. We're unsure exactly which drop, but we had previously created an AngularJS web part that had (a)microsoft/sp-client-base: "~0.7.0" and (a)microsoft/sp-build-web: "~0.9.0" specified in its package.json.

  • Web part loads correctly in local SharePoint Workbench , as well as workbench hosted in SharePoint.

I do hope that is the required information to look into the issue. If not, please let me know what other data you may require.

Best,

joselarios avatar Jun 21 '17 19:06 joselarios

How are you referencing AngularJS?

waldekmastykarz avatar Jun 23 '17 07:06 waldekmastykarz

We installed AngularJS (and AngularJS typings) using the commands: npm install --save [email protected] npm install (a)types/angular --save-dev

After which we referenced AngularJS in the webpart's main entry point as: import * as angular from 'angular';

This import statement is also used in our app-modulte.ts file, which specifies the AngularJS main module. It is used again in our AngularJS Controller file. I believe an AngularJS reference in our Controller file was providing an error when running "gulp serve". Adding in the import statement above fixed the error. I can't recall exactly which error, but I can find out should you need that information.

Please let me know if there's any other data you need.

joselarios avatar Jun 26 '17 20:06 joselarios

It sounds like you're using some old versions of @microsoft/sp-client-base and @microsoft/sp-build-web. Can you update your package.json to refer to all of the latest versions of the SPFx packages?

See instructions here.

iclanton avatar Jun 26 '17 22:06 iclanton

Both @microsoft/sp-client-base and @microsoft/sp-build-web are noted as versions "~1.0.0" in my package.json. I believe those are the latest versions from the GA drop documentation.

joselarios avatar Jun 26 '17 23:06 joselarios

Have you defined AngularJS in the externals section of your project config or are you including it in the web part bundle?

waldekmastykarz avatar Jun 27 '17 06:06 waldekmastykarz

I am including it in the web part bundle and not defining it in the externals section of my project config.

joselarios avatar Jun 27 '17 10:06 joselarios

Any update on this? i'm working with @joselarios and I do not think this is a problem with the references of AngularJS. I could be wrong here but the error message is not very descriptive. We seem to be using the latest drop and it appears to be an error in Classic mode.

juanmlarios avatar Jun 30 '17 19:06 juanmlarios

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 29 '20 06:01 msft-github-bot