# M2不知道为什么执行下面命令失败：indexer:reindex customer\_grid

**URL:** https://forum.magentochina.org/t/m2%E4%B8%8D%E7%9F%A5%E9%81%93%E4%B8%BA%E4%BB%80%E4%B9%88%E6%89%A7%E8%A1%8C%E4%B8%8B%E9%9D%A2%E5%91%BD%E4%BB%A4%E5%A4%B1%E8%B4%A5%EF%BC%9Aindexerreindex-customergrid/307
**Category:** Magento 2.X
**Created:** [2018 年2 月 1 日 06:19 UTC](https://forum.magentochina.org/t/m2%E4%B8%8D%E7%9F%A5%E9%81%93%E4%B8%BA%E4%BB%80%E4%B9%88%E6%89%A7%E8%A1%8C%E4%B8%8B%E9%9D%A2%E5%91%BD%E4%BB%A4%E5%A4%B1%E8%B4%A5%EF%BC%9Aindexerreindex-customergrid/307 "2018-02-01T06:19:59Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### 作者： ![huichen2017](https://forum.magentochina.org/user_avatar/forum.magentochina.org/huichen2017/32/193_2.png) [@huichen2017](https://forum.magentochina.org/u/huichen2017)
#### 发布日期： [2018 年2 月 1 日 06:19 UTC](https://forum.magentochina.org/t/m2%E4%B8%8D%E7%9F%A5%E9%81%93%E4%B8%BA%E4%BB%80%E4%B9%88%E6%89%A7%E8%A1%8C%E4%B8%8B%E9%9D%A2%E5%91%BD%E4%BB%A4%E5%A4%B1%E8%B4%A5%EF%BC%9Aindexerreindex-customergrid/307/1 "2018-02-01T06:19:59Z")

</div>

M2.1.8不知道为什么执行下面命令失败：indexer:reindex customer\_grid  
执行后返回：Invalid foreign key

---

<div class="post-metadata">

### 作者： ![Shuai](https://forum.magentochina.org/user_avatar/forum.magentochina.org/shuai/32/3_2.png) [@Shuai](https://forum.magentochina.org/u/Shuai)
#### 发布日期： [2018 年2 月 1 日 07:43 UTC](https://forum.magentochina.org/t/m2%E4%B8%8D%E7%9F%A5%E9%81%93%E4%B8%BA%E4%BB%80%E4%B9%88%E6%89%A7%E8%A1%8C%E4%B8%8B%E9%9D%A2%E5%91%BD%E4%BB%A4%E5%A4%B1%E8%B4%A5%EF%BC%9Aindexerreindex-customergrid/307/2 "2018-02-01T07:43:57Z")

</div>

不加参数试试呢?  
直接运行:

> bin/magento index:reindex

---

<div class="post-metadata">

### 作者： ![huichen2017](https://forum.magentochina.org/user_avatar/forum.magentochina.org/huichen2017/32/193_2.png) [@huichen2017](https://forum.magentochina.org/u/huichen2017)
#### 发布日期： [2018 年2 月 1 日 07:48 UTC](https://forum.magentochina.org/t/m2%E4%B8%8D%E7%9F%A5%E9%81%93%E4%B8%BA%E4%BB%80%E4%B9%88%E6%89%A7%E8%A1%8C%E4%B8%8B%E9%9D%A2%E5%91%BD%E4%BB%A4%E5%A4%B1%E8%B4%A5%EF%BC%9Aindexerreindex-customergrid/307/3 "2018-02-01T07:48:50Z")

</div>

刚知道问题了，买了个后台高级权限的插件，然后执行这个命令就失败了，准备联系客服的要。  
插件地址：[https://amasty.com/advanced-permissions-for-magento-2.html](https://amasty.com/advanced-permissions-for-magento-2.html)

---

<div class="post-metadata">

### 作者： ![Shuai](https://forum.magentochina.org/user_avatar/forum.magentochina.org/shuai/32/3_2.png) [@Shuai](https://forum.magentochina.org/u/Shuai)
#### 发布日期： [2018 年2 月 1 日 08:04 UTC](https://forum.magentochina.org/t/m2%E4%B8%8D%E7%9F%A5%E9%81%93%E4%B8%BA%E4%BB%80%E4%B9%88%E6%89%A7%E8%A1%8C%E4%B8%8B%E9%9D%A2%E5%91%BD%E4%BB%A4%E5%A4%B1%E8%B4%A5%EF%BC%9Aindexerreindex-customergrid/307/4 "2018-02-01T08:04:17Z")

</div>

问下客服吧，如果解决了问题，再来问答下这个问题.  
amasty的插件质量一般都比较好的，售后也还好，比较坑的是版本升级也要付费。
