I'm adding VR functionality to an existing React app, and so I installed a library called '@coconut-xr/natuerlich'. I have tried this library before in a fresh project and used it just fine, following along with their examples without problem. However, when I tried adding it to the existing React app it does not run.
I import from the library in the exact same way as their examples and as I did in my fresh project.
import {
XRCanvas,
Hands,
Controllers
} from '@coconut-xr/natuerlich/defaults';
import {
useXR,
NonImmersiveCamera,
ImmersiveSessionOrigin
} from '@coconut-xr/natuerlich/react';
But when I run the app, I get a Module not found: Can't resolve '@coconut-xr/natuerlich/defaults'
error.
The package is in the package.json
dependencies, I've tried deleting node_modules
and running yarn cache clear
then yarn install
, I've tried removing the package from the dependencies and adding it again with yarn add @coconut-xr/natuerlich
, but nothing works.
If it's relevant, the fresh project was a next.js app using npm to manage dependencies, while the app I'm trying to add the library to was created with create-react-app and uses yarn.
Can anyone help me out?
Turns out it was a version conflict with other dependencies in my project. Should anyone find this also having this same problem with coconut-xr, it was due to react-scripts being version 4 instead of 5.