# 更新失败：由于某些文件无法复制，因此无法安装更新

**URL:** https://meta.discourse.org/t/update-failed-the-update-cannot-be-installed-because-some-files-could-not-be-copied/257788
**Category:** WordPress
**Tags:** wordpress
**Created:** [2023年三月11日 11:51 UTC](https://meta.discourse.org/t/update-failed-the-update-cannot-be-installed-because-some-files-could-not-be-copied/257788 "2023-03-11T11:51:56Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![haydenjames](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/haydenjames/32/255678_2.png) [@haydenjames](https://meta.discourse.org/u/haydenjames)
#### Post date: [2023年三月11日 11:51 UTC](https://meta.discourse.org/t/update-failed-the-update-cannot-be-installed-because-some-files-could-not-be-copied/257788/1 "2023-03-11T11:51:56Z")

</div>

WP-Discourse 最新更新时出现此错误：

> 更新失败：由于某些文件无法复制，因此无法安装更新。这通常是由于文件权限不一致造成的。

我更新了另外 3 个插件都没有问题。只有此插件出现错误：

 ![image](https://global.discourse-cdn.com/meta/original/4X/6/9/1/6912c41139d6eb3b8849e9231e47c16938d27cf4.png)

根本没有更改任何权限。（其他插件更新也没有问题）有什么想法吗？

导航到 /wp-content/plugins/ 和 /wp-content/plugins/wp-discourse/，所有文件和目录的权限/所有权与其他所有插件都相同。

编辑：只需删除该插件并通过 wp-admin 重新安装即可解决问题。希望没有什么被搞砸了。与此插件的合作并不顺利。

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [2023年三月11日 12:40 UTC](https://meta.discourse.org/t/update-failed-the-update-cannot-be-installed-because-some-files-could-not-be-copied/257788/2 "2023-03-11T12:40:59Z")

</div>

嘿 @haydenjames，

虽然我明白您在其他更新中没有遇到此问题，但此错误与插件无关。它与您的服务器设置有关。您可以在此处阅读更多相关信息：

> **[Cannot update Wordpress plugins (file permission issues)? | DigitalOcean](https://www.digitalocean.com/community/questions/cannot-update-wordpress-plugins-file-permission-issues)**
>
> I get: Update Failed: The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions. Whe…

---

<div class="post-metadata">

### Author: ![haydenjames](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/haydenjames/32/255678_2.png) [@haydenjames](https://meta.discourse.org/u/haydenjames)
#### Post date: [2023年三月11日 12:53 UTC](https://meta.discourse.org/t/update-failed-the-update-cannot-be-installed-because-some-files-could-not-be-copied/257788/3 "2023-03-11T12:53:48Z")

</div>

谢谢。我无需对服务器设置做任何更改。只需通过 wp-admin UI 停用、删除并重新安装即可。所以很可能是个小故障。谢谢！

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [2023年三月11日 12:56 UTC](https://meta.discourse.org/t/update-failed-the-update-cannot-be-installed-because-some-files-could-not-be-copied/257788/4 "2023-03-11T12:56:15Z")

</div>

这种情况经常发生，因为 WordPress 下的目录所有者已被更改为 root。如果属实，那么 `chown -R www-data:www-data /var/www/public_html` 或根据发行版和路径类似的命令会有帮助。

---

<div class="post-metadata">

### Author: ![haydenjames](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/haydenjames/32/255678_2.png) [@haydenjames](https://meta.discourse.org/u/haydenjames)
#### Post date: [2023年三月11日 13:06 UTC](https://meta.discourse.org/t/update-failed-the-update-cannot-be-installed-because-some-files-could-not-be-copied/257788/5 "2023-03-11T13:06:08Z")

</div>

> [@haydenjames](#):
>
> 导航到 /wp-content/plugins/ 和 /wp-content/plugins/wp-discourse/，所有文件和目录的权限/所有权都与其他所有插件相同。

是的，发帖前我检查过了。chown 是正确的，并且是递归正确的。包括所有权和权限。

谢谢

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [2023年三月11日 13:12 UTC](https://meta.discourse.org/t/update-failed-the-update-cannot-be-installed-because-some-files-could-not-be-copied/257788/6 "2023-03-11T13:12:03Z")

</div>

在大多数情况下，糟糕的管理员会在每个月更改时都看到此问题，并尝试上传媒体。

我曾遇到过其他插件的类似错误，但最近没有。但我记不清当时的问题是什么了——但我对插件的糟糕行为的记忆非常模糊。或者我用 geo-ip 和/或阻止 IP 做了一些奇怪的事情。

您是否使用任何安全插件？或者 Fail2ban？

WP-CLI 可能会提供更具信息量的错误。或者不提供。

---

<div class="post-metadata">

### Author: ![haydenjames](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/haydenjames/32/255678_2.png) [@haydenjames](https://meta.discourse.org/u/haydenjames)
#### Post date: [2023年三月11日 13:13 UTC](https://meta.discourse.org/t/update-failed-the-update-cannot-be-installed-because-some-files-could-not-be-copied/257788/7 "2023-03-11T13:13:36Z")

</div>

`ls -lR wp-discourse/`  
…已正确返回。
