Failed to load component when using spfx

luee johnlu 100 Reputation points
2024-04-21T17:54:16.4433333+00:00

When we published the spfx web part to the sharepoint modern page. The page return following error

[SPLoaderError.loadComponentError]:

***Failed to load component "9951b316-c8f2-4e27-887a-b7a46b3e94a0" (ContosoSPFxWebPart).

Original error: ***Failed to load path dependency "ContosoSPFxWebPartLocalization" from component "9951b316-c8f2-4e27-887a-b7a46b3e94a0" (ContosoSPFxWebPart).

Original error: Error loading https://component-id.invalid/9951b316-c8f2-4e27-887a-b7a46b3e94a0_1.3.1/ContosoSPFxWebPartLocalization

 Unable to load script https://xxx.sharepoint.com/sites/aabc/ClientSideAssets/490f3be2-7e8a-4fe5-8d6b-49ae5d7c4a2e/s-ContosoSPFxWebPartLocalization_en-us_2b301efaa958eadafbad865f710d89e4.js



***INNERERROR:

***Failed to load path dependency "ContosoSPFxWebPartLocalization" from component "9951b316-c8f2-4e27-887a-b7a46b3e94a0" (ContosoSPFxWebPart).

Original error: Error loading https://component-id.invalid/9951b316-c8f2-4e27-887a-b7a46b3e94a0_1.3.1/ContosoSPFxWebPartLocalization

 Unable to load script https://xxx.sharepoint.com/sites/abc/ClientSideAssets/490f3be2-7e8a-4fe5-8d6b-49ae5d7c4a2e/s-ContosoSPFxWebPartLocalization_en-us_2b301efaa958eadafbad865f710d89e4.js

***CALLSTACK:

Error

 at t [as constructor] (https://spoprod-a.akamaihd.net/files/sp-client-prod_2019-03-15.008/sp-pages-assembly_en-us_2676c0dcef2e33d08d5b8433ef878499.js:889:16049)

 at new t (https://spoprod-a.akamaihd.net/files/sp-client-prod_2019-03-15.008/sp-pages-assembly_en-us_2676c0dcef2e33d08d5b8433ef878499.js:1512:21125)

 at Function.e.buildErrorWithVerboseLog (https://spoprod-a.akamaihd.net/files/sp-client-prod_2019-03-15.008/sp-pages-assembly_en-us_2676c0dcef2e33d08d5b8433ef878499.js:1512:16214)

 at Function.e.buildLoadComponentError (https://spoprod-a.akamaihd.net/files/sp-client-prod_2019-03-15.008/sp-pages-assembly_en-us_2676c0dcef2e33d08d5b8433ef878499.js:1512:12245)

 at https://spoprod-a.akamaihd.net/files/sp-client-prod_2019-03-15.008/sp-pages-assembly_en-us_2676c0dcef2e33d08d5b8433ef878499.js:1512:60385


Please help fix

SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,676 questions
0 comments No comments
{count} votes

Accepted answer
  1. hossein jalilian 3,015 Reputation points
    2024-04-21T20:58:50.8266667+00:00

    Thanks for posting your question in the Microsoft Q&A forum.

    The error suggests an issue with loading the script from the provided URL. To resolve this, consider the following steps:

    1. Ensure that all dependencies for your SPFx web part, including "ContosoSPFxWebPartLocalization", are correctly defined in your project's configuration files (package.json, config/config.json, etc.).
    2. Try rebuilding your SPFx solution and republishing it to SharePoint. Sometimes, the issue can be resolved by simply redeploying the web part.
    3. Double-check the URLs specified in your code for loading scripts and dependencies. Ensure that they point to the correct locations and that the resources are accessible.
    4. Ensure that the user accessing the SharePoint site has the necessary permissions to access the specified resources, especially if they are hosted externally.

    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful

    0 comments No comments

0 additional answers

Sort by: Most helpful