How to: Resolve “Part URI is not valid” (SPFx)

While following through the tutorial for SPFx @ Microsoft Docs, I created a web part that uses some assets, which need to be packaged in the .sppkg to be deployed along with the solution.  I followed the steps as they are described in the documentation, but, still, when I deployed my web part to my development environment, I received the following error message:

Invalid SharePoint App Package. Error: Part URI is not valid per rules defined in the Open Packaging Conventions specification.

This was a somewhat nasty issue to troubleshoot. The problem is that both “gulp bundle –ship” and “gulp package-solution –ship” complete successfully and don’t report any issues with the code. However, as soon as I deployed the webpart to my App Catalogue, I was greeted with the following:


To be honest, the solution itself is a lot simpler than the time it took to figure out why this happens.

What were some possible solutions:

Searching for the issue online, there were a few suggested solutions, which all revolved around the project/solution name. I did go ahead and removed the dashes (as was suggested) from all references to the solution’s name. I rebuilt, but no cigar. The error remained even after removing the dashes everywhere in my code.

What was the actual problem:

Irregular or bizarre as it may be, the issue seems to originate at the hosting folder structure of the solution. The name of the project/solution had nothing to do with this issue. Moving my solution at the root of my hard drive, into a folder whose name had no spaces or dashes seemed to do the trick.

What was the actual fix:

To resolve this issue, I had to:

  1. Move my project into a folder whose name had no spaces nor dashes. In fact, there were absolutely zero non-alphabetical characters in the folder’s name: spoProvision
  2. Clean the solution (since I had built and packaged once, before attempting to deploy to my app catalogue): gulp clean
  3. Bundle and package in “spoProvision” at the root of my hard drive, after having cleaned the project as explained above:
    1. gulp bundle –ship
    2. gulp package-solution –ship
  4. Deploy the .sppkg file from /sharepoint to the app catalogue
MGR: the Intelogist

About MGR: the Intelogist

SharePoint Server developer, turned Sitefinity developer, turned Angular developer, turned SharePoint Online consultant, turned Unily consultant, turned O365 consultant... Never a dull moment!

7 thoughts on “How to: Resolve “Part URI is not valid” (SPFx)

  1. This fixed this issue for me. Such a strange bug, but thanks for the tip!

  2. JonEirik

    Thank you very much!

  3. Grenouille

    Thanks! it has no sense but it worked 🙂

  4. Ravi Chander Manthoju

    you are great.

    • Thank you for taking the time to comment Ravi. I’m glad you found this useful!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

This site uses Akismet to reduce spam. Learn how your comment data is processed.