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

Asset Packaging error when the solution name has - in the name

Open joaoferreira opened this issue 8 years ago • 24 comments

Category

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

Expected or Desired Behavior

Being able to deploy a valid package to the app catalog

Observed Behavior

When the solution name has a - in the name the sppkg will throw an error once the web part is added to the app catalog. This behaviour was observed on global app catalog and also in the site collection app catalog. The error messages is Invalid SharePoint App package. Error: Part URI is not valid per rules defined in the Open Packaging Conventions specification. This error is caused by the assetpackagingwebpartstrings file located in the ClientSideAssets folder inside the package. Instead of using the - the file is created with a space in the name and it breaks the OPC specification.

Steps to Reproduce

  1. Using yeoman generator create a new web part with a - in the name
  2. Run the command gulp bundle --ship
  3. Run the command gulp package-solution --ship
  4. Add the package file to the app catalog

joaoferreira avatar Dec 09 '17 15:12 joaoferreira

I have this same problem, unfortunately - the error persists even after removing the dashes.

jaredbuttars avatar Jan 20 '18 20:01 jaredbuttars

After some experimenting, It's actually related to the CDN basepath not the package name. when set to the folllowing in order to package assets into the sppkg:

"cdnBasePath": "<!-- PATH TO CDN -->"

The package is invalid with the error:

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

jaredbuttars avatar Jan 20 '18 20:01 jaredbuttars

Same problem for me too even after completely updating manifest and package solution files

kulkarnichief avatar Feb 02 '18 10:02 kulkarnichief

I ran into this too. It showed up when I added "includeClientSideAssets": true to my package-solution.json file and built to ship. The fix for me ended up being to rename the directory that held my git project to remove any spaces from it. After that, it deployed fine.

kduenke avatar Feb 08 '18 18:02 kduenke

I get the same problem today with SPFx 1.4.1

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

if I set "includeClientSideAssets": false the problem goes away but webpart doesn't work accordingly

aslanovsergey avatar Mar 16 '18 11:03 aslanovsergey

I can confirm that I have the same issue. I followed the tutorial series but did not opt to enable an O365 or Azure CDN.

colonelclaypoo avatar Mar 23 '18 09:03 colonelclaypoo

Very nasty bug, have no idea how deploy my web part. Removing spaces in folder, shortening solution name didn't help... PnP Team please look at it, I would give maximum importance to this ticket

Name of folder(before it was with spaces and I replaced spaces with dashes): shared-mailbox-access-approval-request-form package-solution.json { "$schema": "https://dev.office.com/json-schemas/spfx-build/package-solution.schema.json", "solution": { "name": "shared-mailbox-access-approval-request-form-client-side-solution", "id": "eaa1a1a1-d2fa-44db-a28c-0ae53021d73e", "version": "1.0.0.0", "includeClientSideAssets": true }, "paths": { "zippedPackage": "solution/shared-mailbox-access-approval-request-form.sppkg" } }

aslanovsergey avatar Mar 26 '18 07:03 aslanovsergey

I could correct that error change the name folder that have the project without dashes ("-") and spaces (" ").

jesusvelasco93 avatar Apr 12 '18 07:04 jesusvelasco93

Removing whitespace from path helped in here.

mcraiha avatar Apr 26 '18 10:04 mcraiha

What helped me was cleaning temp/deploy folder

aslanovsergey avatar Apr 26 '18 11:04 aslanovsergey

This seems to have to do with the way that the string resource files are bundled. The generated .js files seem to be prefixed with the name of the folder containing the solution. If the folder name contains a space, then the file names will contain a space, and SharePoint seems to not like this.

It seems pretty unnecessary to have the file names contain the solution's folder name, and I'm wondering if this is a bug in the gulp bundle procedure. It may be possible to remedy this by modifying said procedure, but being fairly unfamiliar with gulp, I wouldn't know how to go about that.

JLRishe avatar May 29 '18 14:05 JLRishe

Solved removing the space on the name of the folder were the solution was stored and on one of the files.

Dangerous-Mind avatar Sep 24 '18 08:09 Dangerous-Mind

What helped me was cleaning temp/deploy folder

Thanks, you have saved my time....

rajamaniperumal avatar Oct 16 '18 01:10 rajamaniperumal

Wicked error message...not helpful. In my case I had an asset (image file) that had a space in the filename. Once I renamed the file and did a clean, I was able to package and deploy again.

kylepdx avatar Oct 24 '18 05:10 kylepdx

Had to - Rename project folder (it had spaces) Check for dashes in the solution names_(removed, just in case)_ Delete temp/deploy folder Gulp bundle --ship Gulp Package-solution --ship

Working fine!!

ravinleague avatar Oct 26 '18 01:10 ravinleague

Seems like things are resolved by cleaning & rebuilding the project?

andrewconnell avatar Feb 01 '19 11:02 andrewconnell

The solutions above helped me.

  1. Remove spaces from the path.
  2. Clean
  3. Rebuild and package.

In my case, I found a space in a parent directory my source code was under.

jonathaneckman avatar Feb 03 '19 18:02 jonathaneckman

This issue has been automatically marked as stale because it has marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within next 7 days of this comment. Thank you for your contributions to SharePoint Developer activities.

msft-github-bot avatar Feb 10 '19 19:02 msft-github-bot

This still happens, I did a test today and got the same error. The workaround provided in this thread helped me to get it working

  • Rename project folder (it had spaces)
  • Check for dashes in the solution names_(removed, just in case)_
  • Delete temp/deploy folder
  • Gulp bundle --ship
  • Gulp Package-solution --ship

joaoferreira avatar Feb 11 '19 10:02 joaoferreira

@joaoferreira I just created 2 new projects and tested the deployment on each:

  • project folder with no spaces/hyphens, project name with hyphen = pass
  • project folder with no spaces/hyphens, project name with space = fail

So the original reason for the issue, hyphens in the project name, is no longer a problem. However, spaces are a problem. With that being said... it's not really a bug as things are working as expected, but a feature enhancement for the generator could be to not allow spaces for the project name. In that case, it should be submitted as a feature request via UserVoice @ https://aka.ms/sp-dev-uservoice.

Therefore, I'm going to close this issue since the root reason for the issue is no longer applicable.

andrewconnell avatar Feb 11 '19 11:02 andrewconnell