rapier.js icon indicating copy to clipboard operation
rapier.js copied to clipboard

Testbed demos `Can't resolve '@dimforge/rapier2d'`

Open m-clare opened this issue 2 years ago • 5 comments

I'm trying to test out rapier.js for the first time, and according to the Getting started docs, I should be able to use the testbed3d/src/demos directory to get up and running.

Running npm install && npm run start from ${HOME}/rapier.js/testbed2d results in the following compilation error (and all subsequent files complain about being unable to find the module):

ERROR in ./src/index.ts 11:0-28

Module not found: Error: Can't resolve '@dimforge/rapier2d' in '${HOME}/rapier.js/testbed2d/src'

What is the entry point to working with testbed?

m-clare avatar Feb 26 '23 22:02 m-clare

Similar (possibly related) issue here. I ran npm i @dimforge/rapier2d and tried to import it from my code and it's throwing a ERR_MODULE_NOT_FOUND. Can't get it to work at all.

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '/home/runner/RapierTest/node_modules/@dimforge/rapier2d/' imported from /home/runner/RapierTest/index.js

JamzOJamz avatar Feb 27 '23 17:02 JamzOJamz

I'm just getting this on a new 3D project:

Error: Cannot find module '@dimforge/rapier3d'

OldManMeta avatar Mar 06 '23 09:03 OldManMeta

I have this problem, too:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'C:\repositories\<redacted>\node_modules\@dimforge\rapier2d\' imported from C:\repositories\<redacted>\<redacted>.js

I'm on Windows 10 if that matters.

dsine-de avatar Mar 14 '23 11:03 dsine-de

@dsine-de - I think the underlying issue with this error is in how the bundler works in your solution. For example, I could not get webpack to work at all.

In the end, I used the compat packages with node/typescript solutions and it works fine.

https://rapier.rs/docs/user_guides/javascript/getting_started_js#using-rapier-without-a-bundler

@sebcrozet - I think this should be closed as it isn't an error with the rapier project per say.

OldManMeta avatar Mar 14 '23 11:03 OldManMeta

It seems that changing the line

 "@dimforge/rapier3d": "file:../rapier3d"

in the package.json to

"@dimforge/rapier3d": "latest"

will work

ww1g11 avatar Aug 05 '24 06:08 ww1g11