Answers.Body: <p>Based on comments the <code>-D</code> <a href="https://lab.civicrm.org/dev/civicrm-asset-plugin/-/blob/88c7dd0c93b6b5a4453a63e523706c941086763b/src/Command/CivicrmPublishCommand.php#L21" rel="noreferrer">option</a> cleared out the cobwebs.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-03-22T22:15:11.083Z
Answers.Text: Same issue for me after a Civicrm upgrade: "Wrong version of assets in public web directory: expected 5.71.1 but found 5.70.2." Numerous attempts at `composer civicrm:publish` didn't work until I added the `-D` option. Thanks for the tip @Demerit.
Answers.UserDisplayName: Justin657
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-02-19T23:43:50.027Z
Answers.LastActivityDate: 2024-02-19T23:43:50.027Z
Answers.UserDisplayName: Demerit
Body: <p>I recently had an error becuase my <strong>kcfinder</strong> package was out of date. I fixed it by manually copying the <code>kcfinder</code> folder from <code>dir/vendor/civicrm/civicrm-packages</code> to <code>dir/html/libraries/civicrm/packages</code>. I had tried running <code>composer civicrm:publish</code> but it seems this command is not working as expected for me.</p>
  <p>I have a slightly different structure in my project as follows:</p>
  <pre><code>    dir
      -html
      --libraries
      ---civicrm
      ----packages
      -vendor
      --civicrm
      ---civicrm-packages
  </code></pre>
  <p>so in my root composer.json I have:</p>
  <pre><code>&quot;civicrm-asset&quot;: {
              &quot;path&quot;: &quot;html/libraries/civicrm&quot;,
              &quot;url&quot;: &quot;/libraries/civicrm&quot;
          },
  </code></pre>
  <p>When I run <code>composer civicrm:publish</code>, it looks like it runs fine, I get the message:</p>
  <pre><code>Publishing CiviCRM assets to html/libraries/civicrm
  Generating CiviCRM asset map
  </code></pre>
  <p>however, no new files seem to get written to the packages folder <code>html/libraries/civicrm/packages</code>. I tried changing the <code>civicrm-asset</code> paths in my <code>composer.json</code> file to:</p>
  <pre><code> &quot;civicrm-asset&quot;: {
              &quot;path&quot;: &quot;html/libraries/civicrm/packages&quot;,
              &quot;url&quot;: &quot;/libraries/civicrm/packages&quot;
          },
  </code></pre>
  <p>Then this generates a new folder <code>packages</code> inside the existing <code>html/libraries/civicrm/packages</code> folder and has copied across the libraries. However, it doesn't copy all the files, it doesn't seem to copy some of the folders or any of the <code>.php</code> files.</p>
  <p>I am recently now also getting an error on my status page:</p>
  <blockquote>
  <p>Wrong version of assets in public web directory: expected 5.70.0 but found 5.69.4</p>
  </blockquote>
  <p>I checked the permissions on the <code>html/libraries/civicrm/packages</code> folder and they seem to be fine so not sure what the problem is. I also thought it would be useful to view the generated CiviCRM asset map, but wasn't sure how to do this.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-02-19T18:25:46.827Z
Comments.Text: I think your original config was fine. Try the `-D` [option](https://lab.civicrm.org/dev/civicrm-asset-plugin/-/blob/88c7dd0c93b6b5a4453a63e523706c941086763b/src/Command/CivicrmPublishCommand.php#L21) to do a complete copy. But note that (a) the plugin isn't supposed to copy everything, just web assets, and (b) kcfinder is known to have problems with drupal 8+. Consider using [summernote](https://lab.civicrm.org/extensions/summernote) as your editor instead.
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-02-19T20:03:55.083Z
Comments.Text: Thanks so much @Demerit, the -D option worked, all the packages were copied over. I should have known there would have been some command options! Thanks also for the tip on summernote, although kcfinder is working ok at the moment even with Drupal 10.
Comments.UserDisplayName: Ben
Tags: <composer>
Title: Problems with composer civicrm:publish
ThreadText: # Problems with composer civicrm:publish
  
  (Asked by: username_0 on 2024-02-19)
  
  I recently had an error becuase my **kcfinder** package was out of date. I fixed it by manually copying the `kcfinder` folder from `dir/vendor/civicrm/civicrm-packages` to `dir/html/libraries/civicrm/packages`. I had tried running `composer civicrm:publish` but it seems this command is not working as expected for me.
  
  I have a slightly different structure in my project as follows:
  
  ```
      dir
      -html
      --libraries
      ---civicrm
      ----packages
      -vendor
      --civicrm
      ---civicrm-packages
  
  ```
  
  so in my root composer.json I have:
  
  ```
  "civicrm-asset": {
              "path": "html/libraries/civicrm",
              "url": "/libraries/civicrm"
          },
  
  ```
  
  When I run `composer civicrm:publish`, it looks like it runs fine, I get the message:
  
  ```
  Publishing CiviCRM assets to html/libraries/civicrm
  Generating CiviCRM asset map
  
  ```
  
  however, no new files seem to get written to the packages folder `html/libraries/civicrm/packages`. I tried changing the `civicrm-asset` paths in my `composer.json` file to:
  
  ```
   "civicrm-asset": {
              "path": "html/libraries/civicrm/packages",
              "url": "/libraries/civicrm/packages"
          },
  
  ```
  
  Then this generates a new folder `packages` inside the existing `html/libraries/civicrm/packages` folder and has copied across the libraries. However, it doesn't copy all the files, it doesn't seem to copy some of the folders or any of the `.php` files.
  
  I am recently now also getting an error on my status page:
  
  > Wrong version of assets in public web directory: expected 5.70.0 but found 5.69.4
  
  I checked the permissions on the `html/libraries/civicrm/packages` folder and they seem to be fine so not sure what the problem is. I also thought it would be useful to view the generated CiviCRM asset map, but wasn't sure how to do this.
  
  **Tags:** composer
  
  > **Comments:**
  > **username_1**: I think your original config was fine. Try the `-D` [option](https://lab.civicrm.org/dev/civicrm-asset-plugin/-/blob/88c7dd0c93b6b5a4453a63e523706c941086763b/src/Command/CivicrmPublishCommand.php#L21) to do a complete copy. But note that (a) the plugin isn't supposed to copy everything, just web assets, and (b) kcfinder is known to have problems with drupal 8+. Consider using [summernote](https://lab.civicrm.org/extensions/summernote) as your editor instead.  
  > **username_0**: Thanks so much @username_1, the -D option worked, all the packages were copied over. I should have known there would have been some command options! Thanks also for the tip on summernote, although kcfinder is working ok at the moment even with Drupal 10.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-02-19. Score: 7 | Accepted answer
  
  Based on comments the `-D` [option](https://lab.civicrm.org/dev/civicrm-asset-plugin/-/blob/88c7dd0c93b6b5a4453a63e523706c941086763b/src/Command/CivicrmPublishCommand.php#L21) cleared out the cobwebs.
  
  > **Comments:**
  > **username_2**: Same issue for me after a Civicrm upgrade: "Wrong version of assets in public web directory: expected 5.71.1 but found 5.70.2." Numerous attempts at `composer civicrm:publish` didn't work until I added the `-D` option. Thanks for the tip @username_1.  
  
  ---
  
  