我已经安装了react三根光纤,这是一个依赖
"dependencies": {
"@react-three/drei": "^3.0.0",
"@testing-library/jest-dom": "^5.11.9",
"@testing-library/react": "^11.2.3",
"@testing-library/user-event": "^12.6.0",
"drei": "^2.2.21",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.1",
"react-spring": "^8.0.27",
"react-three-fiber": "^5.3.18",
"three": "^0.125.1",
"web-vitals": "^0.2.4"},
然后我运行npm i drei
之后,我尝试导入useGLTF
import { useGLTF } from '@react-three/drei/useGLTF'我得到了一个错误
./src/Components/Three/Scene.js
Module not found: Can't resolve '@react-three/drei/useGLTF' in 'D:\coding\react\mincraft\src\Components\Three'我决定在@react-three/drei/useGLTF中手动检查文件,但没有像useGLTF这样的名称
我还需要运行其他东西吗?
发布于 2021-01-29 16:19:48
见鬼。一段时间后,我在drei/core/useGLTF中找到了useGLTF。
import { useGLTF } from '@react-three/drei/core/useGLTF'发布于 2021-06-17 04:26:49
尝试运行npm install three。这对我很管用
https://stackoverflow.com/questions/65950660
复制相似问题