Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Three.js dependency version mismatch #62

Closed
rozek opened this issue Nov 5, 2023 · 9 comments
Closed

Three.js dependency version mismatch #62

rozek opened this issue Nov 5, 2023 · 9 comments

Comments

@rozek
Copy link

rozek commented Nov 5, 2023

I just downloaded the repo and tried to build.

However, npm install failed with

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: @polygonjs/polygonjs@1.5.27
npm ERR! Found: three@0.152.2
npm ERR! node_modules/three
npm ERR!   three@"0.152.2" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer three@"^0.141.0" from three-bvh-csg@0.0.5
npm ERR! node_modules/three-bvh-csg
npm ERR!   three-bvh-csg@"0.0.5" from the root project

What is your recommendation for a fix?

@rozek
Copy link
Author

rozek commented Nov 5, 2023

Amendment: for the moment, I tried npm install --force and got this list of warnings:

npm WARN using --force Recommended protections disabled.
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: three-bvh-csg@0.0.5
npm WARN Found: three@0.152.2
npm WARN node_modules/three
npm WARN   three@"0.152.2" from the root project
npm WARN   5 more (n8ao, postprocessing, three-gpu-pathtracer, ...)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer three@"^0.141.0" from three-bvh-csg@0.0.5
npm WARN node_modules/three-bvh-csg
npm WARN   three-bvh-csg@"0.0.5" from the root project
npm WARN 
npm WARN Conflicting peer dependency: three@0.141.0
npm WARN node_modules/three
npm WARN   peer three@"^0.141.0" from three-bvh-csg@0.0.5
npm WARN   node_modules/three-bvh-csg
npm WARN     three-bvh-csg@"0.0.5" from the root project
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: three-bvh-csg@0.0.5
npm WARN Found: three-mesh-bvh@0.6.3
npm WARN node_modules/three-mesh-bvh
npm WARN   three-mesh-bvh@"0.6.3" from the root project
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer three-mesh-bvh@"^0.5.13" from three-bvh-csg@0.0.5
npm WARN node_modules/three-bvh-csg
npm WARN   three-bvh-csg@"0.0.5" from the root project
npm WARN 
npm WARN Conflicting peer dependency: three-mesh-bvh@0.5.24
npm WARN node_modules/three-mesh-bvh
npm WARN   peer three-mesh-bvh@"^0.5.13" from three-bvh-csg@0.0.5
npm WARN   node_modules/three-bvh-csg
npm WARN     three-bvh-csg@"0.0.5" from the root project
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: ts-declaration-webpack-plugin@1.2.3
npm WARN Found: webpack@5.76.0
npm WARN node_modules/webpack
npm WARN   dev webpack@"5.76.0" from the root project
npm WARN   14 more (@statoscope/webpack-plugin, ...)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer webpack@"^4.0.0" from ts-declaration-webpack-plugin@1.2.3
npm WARN node_modules/ts-declaration-webpack-plugin
npm WARN   dev ts-declaration-webpack-plugin@"1.2.3" from the root project
npm WARN 
npm WARN Conflicting peer dependency: webpack@4.47.0
npm WARN node_modules/webpack
npm WARN   peer webpack@"^4.0.0" from ts-declaration-webpack-plugin@1.2.3
npm WARN   node_modules/ts-declaration-webpack-plugin
npm WARN     dev ts-declaration-webpack-plugin@"1.2.3" from the root project
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: web-ifc-three@0.0.125
npm WARN Found: three@0.152.2
npm WARN node_modules/three
npm WARN   three@"0.152.2" from the root project
npm WARN   5 more (n8ao, postprocessing, three-gpu-pathtracer, ...)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer three@"^0.149.0" from web-ifc-three@0.0.125
npm WARN node_modules/web-ifc-three
npm WARN   web-ifc-three@"0.0.125" from the root project
npm WARN 
npm WARN Conflicting peer dependency: three@0.149.0
npm WARN node_modules/three
npm WARN   peer three@"^0.149.0" from web-ifc-three@0.0.125
npm WARN   node_modules/web-ifc-three
npm WARN     web-ifc-three@"0.0.125" from the root project

@rozek
Copy link
Author

rozek commented Nov 5, 2023

... and npm run start failed with (many mesages and finally)

webpack 5.76.0 compiled with 68 errors in 88841 ms

Thus, it seems to be more complicated to fix the dependency mismatch(es)

@rozek
Copy link
Author

rozek commented Nov 5, 2023

FYI: npm create polygonjs@latest works better:

cd polygon-project && npm install issues the following warnings:

npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: web-ifc-three@0.0.125
npm WARN Found: three@0.152.2
npm WARN node_modules/@polygonjs/polygonjs/node_modules/three
npm WARN   three@"0.152.2" from @polygonjs/polygonjs@1.5.26
npm WARN   node_modules/@polygonjs/polygonjs
npm WARN     @polygonjs/polygonjs@"1.5.26" from polygonjs-editor@1.5.26-1
npm WARN     node_modules/polygonjs-editor
npm WARN   1 more (three-mesh-bvh)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer three@"^0.149.0" from web-ifc-three@0.0.125
npm WARN node_modules/@polygonjs/polygonjs/node_modules/web-ifc-three
npm WARN   web-ifc-three@"0.0.125" from @polygonjs/polygonjs@1.5.26
npm WARN   node_modules/@polygonjs/polygonjs
npm WARN 
npm WARN Conflicting peer dependency: three@0.149.0
npm WARN node_modules/three
npm WARN   peer three@"^0.149.0" from web-ifc-three@0.0.125
npm WARN   node_modules/@polygonjs/polygonjs/node_modules/web-ifc-three
npm WARN     web-ifc-three@"0.0.125" from @polygonjs/polygonjs@1.5.26
npm WARN     node_modules/@polygonjs/polygonjs

but npm run polygon works and starts up the editor...

@frading
Copy link
Collaborator

frading commented Nov 6, 2023

Thanks a lot for the detailed error messages.

If you want to build the repo, I recommend to use yarn instead (so yarn to install the dependencies, and yarn build to build).

And if you want to start the editor, you can still use npm as you have with npm create polygonjs@latest and npm run polygon. That may not be clear yet (I still need to clarify that in the readme), but this repository only contains the main library, while the editor is not open source.

So if you want to use polygonjs via the editor, that's all you should need.

But if you want to develop against the main library, I do see like you errors when running yarn start. I'll look into those shortly. But those don't happen when you export a scene via the editor, so they may or may not be a blocker depending on how you plan to use polygonjs.

@rozek
Copy link
Author

rozek commented Nov 6, 2023

I will try yarn asap

@rozek
Copy link
Author

rozek commented Nov 6, 2023

Ok,

so I cloned the PolygonJS repo again (from scratch) and yarned. Despite of a few warnings, everything went fine:

yarn install v1.22.19
warning package.json: License should be a valid SPDX license expression
warning @polygonjs/polygonjs@1.5.27: License should be a valid SPDX license expression
[1/5] 🔍  Validating package.json...
warning @polygonjs/polygonjs@1.5.27: License should be a valid SPDX license expression
[2/5] 🔍  Resolving packages...
[3/5] 🚚  Fetching packages...
[4/5] 🔗  Linking dependencies...
warning " > @vue-reactivity/watch@0.2.0" has unmet peer dependency "@vue/shared@>=3.0.0-rc.1".
warning " > opencascade.js@2.0.0-beta.94e2944" has unmet peer dependency "ws@^8.5.0".
warning " > three-bvh-csg@0.0.5" has incorrect peer dependency "three@^0.141.0".
warning " > three-bvh-csg@0.0.5" has incorrect peer dependency "three-mesh-bvh@^0.5.13".
warning " > web-ifc-three@0.0.125" has incorrect peer dependency "three@^0.149.0".
warning " > ts-declaration-webpack-plugin@1.2.3" has incorrect peer dependency "webpack@^4.0.0".
warning Workspaces can only be enabled in private projects.
[5/5] 🔨  Building fresh packages...
✨  Done in 24.42s.

@rozek
Copy link
Author

rozek commented Nov 6, 2023

You may think of explicitly recommending yarn instead of npm or (even better) completely remove any npm examples

@frading
Copy link
Collaborator

frading commented Nov 6, 2023

Yes, I'll put a warning in the docs and readme at the very least. But I still want polygonjs to be as framework/bundler agnostic as possible, so ideally projects scaffolded with yarn create polygonjs or npm create polygonjs@latest should work with both.

In the mean time, I've replaced webpack by vite for the dev build of polygonjs standalone, so yarn start works again without errors. I'm unsure why webpack works in build but not dev, but vite has the additional benefit of being faster.

@frading
Copy link
Collaborator

frading commented Nov 9, 2023

I've got npm install working again. It looks like the reason it was failing was that one of the dependencies ( https://github.com/IFCjs/web-ifc-three ) was requiring an older version of threejs, and npm wasn't able to resolve that as well as yarn. I don't fully understand how yarn/npm work under the hood, so the reason may be different, but removing this dependency ( and therefore refactoring how IFC is handled, see commit ) solved the problem for now.

@frading frading closed this as completed Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants