Answers.Body: <p>This suggests a file permission issue on the relevant folder - which is <code>sites/default/files/civicrm/persist/contribute/dyn/</code>.</p>
  
  <p>First, ensure the parent folders exist - both <code>sites/default/files/civicrm/persist/contribute/dyn/</code> and <code>sites/default/files/civicrm/persist/contribute/</code>.  If both exist, check the permission AND owner of the <code>dyn</code> folder.  Is the owner the same user as the webserver user?  Likewise, if <code>dyn</code> doesn't exist do the same for <code>contribute</code>.  If you're not sure how to check owner/permissions, or how to interpret them, please either a) hop on <a href="https://chat.civicrm.org" rel="nofollow noreferrer">https://chat.civicrm.org</a>, or b) update the question with your operating system (including the distribution, if Linux) and webserver software (most likely Apache or nginx).</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-03T23:37:50.637Z
Answers.Text: What's interesting is that the dyn directory didn't exist. Since it was on a test site, I undid the upgrade for now but will revisit the issue when I upgrade officially and see if it's still an issue. It was probably a caching issue since it was asking for a file that doesn't exist.
Answers.UserDisplayName: Christia
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-04T00:31:26.310Z
Answers.Text: CiviCRM will create the `dyn` directory, but it may not have had the permissions to do so.  Which is odd - there's a permission check that runs daily that will flag if there's an issue.  Since it's a test site, I suspect that either a) the check didn't have a chance to run, or b) your Directories settings are different.
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-02T16:13:11.333Z
Answers.LastActivityDate: 2017-09-02T16:13:11.333Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.Body: <p>I had a similar issue in WordPress.
  I believe the issue is caused because the upgrade script requires resource files to be in their expected place from the old version.  So, if you've created a new install and are just migrating a database, then the error may be triggered.</p>
  
  <p>The resource locations have changed between database versions, so the update script fails if it can't find the old resource files.</p>
  
  <p>I fixed this by copying the old resource files to the expected location (as they are listed in the error - in my case this was <code>plugins/files/civicrm</code>).</p>
  
  <p>For reference, I was updating the CiviCRM database from 4.7.9 to 5.13.5 on Wordpress 5.11.
  Once the files are available, the update should run (In my case, I  needed to retrigger the update with <a href="http://example.org/wp-admin/admin.php?page=CiviCRM&amp;q=civicrm/upgrade&amp;reset=1" rel="nofollow noreferrer">http://example.org/wp-admin/admin.php?page=CiviCRM&amp;q=civicrm/upgrade&amp;reset=1</a>)</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-13T15:50:20.290Z
Answers.LastActivityDate: 2019-06-13T15:50:20.290Z
Answers.UserDisplayName: FGiorlando
Body: <p>I just upgraded CiviCRM on a test version of my Drupal 7.54 site from 4.7.15 to 4.7.23 and get the following (edited) error when going to system status in CiviCRM.</p>
  
  <blockquote>
    <p>Warning: mkdir(): Permission denied in Civi\Core\AssetBuilder->build()
    (line 167 of
    sites/all/modules/contrib/civicrm/Civi/Core/AssetBuilder.php).
    Warning:
    file_put_contents(sites/default/files/civicrm/persist/contribute/dyn/angular-modules.eef75e30334ca152b0d58bf58d4xxxxx.js):
    failed to open stream: No such file or directory in
    Civi\Core\AssetBuilder->build() (line 171 of
    sites/all/modules/contrib/civicrm/Civi/Core/AssetBuilder.php)</p>
  </blockquote>
  
  <p>I made sure that I deleted templates_c and made it and all CiviCRM files writeable to the server.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-06-13T15:31:55.243Z
Comments.Text: I've had the same issue with an upgrade of CiviCRM database in Wordpress.  I think the database must have some references to old resource files as I have also deleted caches.
Comments.UserDisplayName: FGiorlando
Tags: <drupal><permissions>
Title: Permission denied in Civi\Core\AssetBuilder->build()
ThreadText: # Permission denied in Civi\Core\AssetBuilder->build()
  
  (Asked by: username_0 on 2017-09-02)
  
  I just upgraded CiviCRM on a test version of my Drupal 7.54 site from 4.7.15 to 4.7.23 and get the following (edited) error when going to system status in CiviCRM.
  
  > Warning: mkdir(): Permission denied in Civi\Core\AssetBuilder->build()
  > (line 167 of
  > sites/all/modules/contrib/civicrm/Civi/Core/AssetBuilder.php).
  > Warning:
  > file\_put\_contents(sites/default/files/civicrm/persist/contribute/dyn/angular-modules.eef75e30334ca152b0d58bf58d4xxxxx.js):
  > failed to open stream: No such file or directory in
  > Civi\Core\AssetBuilder->build() (line 171 of
  > sites/all/modules/contrib/civicrm/Civi/Core/AssetBuilder.php)
  
  I made sure that I deleted templates\_c and made it and all CiviCRM files writeable to the server.
  
  **Tags:** drupal, permissions
  
  > **Comments:**
  > **username_1**: I've had the same issue with an upgrade of CiviCRM database in Wordpress.  I think the database must have some references to old resource files as I have also deleted caches.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2017-09-02. Score: 2
  
  This suggests a file permission issue on the relevant folder - which is `sites/default/files/civicrm/persist/contribute/dyn/`.
  
  First, ensure the parent folders exist - both `sites/default/files/civicrm/persist/contribute/dyn/` and `sites/default/files/civicrm/persist/contribute/`. If both exist, check the permission AND owner of the `dyn` folder. Is the owner the same user as the webserver user? Likewise, if `dyn` doesn't exist do the same for `contribute`. If you're not sure how to check owner/permissions, or how to interpret them, please either a) hop on <https://chat.civicrm.org>, or b) update the question with your operating system (including the distribution, if Linux) and webserver software (most likely Apache or nginx).
  
  > **Comments:**
  > **username_0**: What's interesting is that the dyn directory didn't exist. Since it was on a test site, I undid the upgrade for now but will revisit the issue when I upgrade officially and see if it's still an issue. It was probably a caching issue since it was asking for a file that doesn't exist.  
  > **username_2**: CiviCRM will create the `dyn` directory, but it may not have had the permissions to do so.  Which is odd - there's a permission check that runs daily that will flag if there's an issue.  Since it's a test site, I suspect that either a) the check didn't have a chance to run, or b) your Directories settings are different.  
  
  ---
  
  ### Answer by username_1 on 2019-06-13. Score: 0
  
  I had a similar issue in WordPress.
  I believe the issue is caused because the upgrade script requires resource files to be in their expected place from the old version. So, if you've created a new install and are just migrating a database, then the error may be triggered.
  
  The resource locations have changed between database versions, so the update script fails if it can't find the old resource files.
  
  I fixed this by copying the old resource files to the expected location (as they are listed in the error - in my case this was `plugins/files/civicrm`).
  
  For reference, I was updating the CiviCRM database from 4.7.9 to 5.13.5 on Wordpress 5.11.
  Once the files are available, the update should run (In my case, I needed to retrigger the update with <http://example.org/wp-admin/admin.php?page=CiviCRM&q=civicrm/upgrade&reset=1>)
  
  
  ---
  
  