threejs-ammojs-webpack-example icon indicating copy to clipboard operation
threejs-ammojs-webpack-example copied to clipboard

Can't resolve 'matter-js'

Open jonas-db opened this issue 3 years ago • 4 comments

I followed the instructions, but i get: @yandeu

ERROR in ./node_modules/@enable3d/three-graphics/jsm/flat/physics/physics.js 6:0-98
Module not found: Error: Can't resolve 'matter-js' in '/Users/x/git/game/tests/enable3d-webpack/node_modules/@enable3d/three-graphics/jsm/flat/physics'

jonas-db avatar Jan 12 '22 18:01 jonas-db

After npm install matter-js it works.. so there must be something wrong with (peer) dependencies

jonas-db avatar Jan 12 '22 18:01 jonas-db

Strange.

matter-js is a peerDependency of @enable3d/three-graphics which is a dependency of enable3d.

yandeu avatar Jan 13 '22 23:01 yandeu

only thing that made it compile for me was adding ALL peer dependencies

"dependencies": {
    "enable3d": "~0.24.1",

    "@types/matter-js": "0.17.6",

    "@types/three": "~0.133.1",

    "matter-js": "0.17.1",

    "phaser": "^3.55.2",

    "poly-decomp": "^0.3.0",

    "three": "~0.133.1"

  },

guivanrv avatar Jan 17 '22 09:01 guivanrv

Maybe it has something to do with our local NPM version. I remember I was on 6.x, while current is 8.x.

jonas-db avatar Jan 20 '22 09:01 jonas-db