安装插件后 Gatsby 站点中断
Gatsby site breaks after installing plugins
我 运行 在安装 gatsby 插件时遇到问题。
我的设置:
npm install -g gatsby-cli
gatsby new my-app
gatsby develop
当我尝试从 Gatsby 库安装插件时,我在安装插件后收到此错误消息:
Error: Invalid hook call. Hooks can only be called inside of the bo
dy of a function component. This could happen for one of the follow
ing reasons:
- You might have mismatching versions of React and the renderer (s uch as React DOM)
- You might be breaking the Rules of Hooks
- You might have more than one copy of React in the same app See fb.me/react-invalid-hook-call for tips about how to deb ug and fix
this problem.
我的dep树有问题吗?
├─┬ gatsby@2.23.10
│ └─┬ gatsby-cli@2.12.50
│ └── react@16.13.1 deduped
└── react@16.13.1
根据上面的评论,解决方案是:
正在删除 node_modules
和 .cache
文件夹,通过 npm install
和 gatsby develop
重新安装依赖项。
我 运行 在安装 gatsby 插件时遇到问题。
我的设置:
npm install -g gatsby-cli
gatsby new my-app
gatsby develop
当我尝试从 Gatsby 库安装插件时,我在安装插件后收到此错误消息:
Error: Invalid hook call. Hooks can only be called inside of the bo dy of a function component. This could happen for one of the follow ing reasons:
- You might have mismatching versions of React and the renderer (s uch as React DOM)
- You might be breaking the Rules of Hooks
- You might have more than one copy of React in the same app See fb.me/react-invalid-hook-call for tips about how to deb ug and fix this problem.
我的dep树有问题吗?
├─┬ gatsby@2.23.10
│ └─┬ gatsby-cli@2.12.50
│ └── react@16.13.1 deduped
└── react@16.13.1
根据上面的评论,解决方案是:
正在删除 node_modules
和 .cache
文件夹,通过 npm install
和 gatsby develop
重新安装依赖项。