Howdy! I started getting an error in my CI/CD pipeline last night after upgrading my project to v5.12.1. I can reliably reproduce it in a GH Action, but not locally.
Everything else is identical between the last successful builds and this one except for the upgraded packages; I compared build logs to verify same node/npm versions etc…
Here’s the error:
ERROR in ./node_modules/@babylonjs/inspector/dist/babylon.inspector.bundle.max.js3:143-175
Module not found: Error: Can't resolve '@babylonjs/gui-editor' in '/github/workspace/node_modules/@babylonjs/inspector/dist'
resolve '@babylonjs/gui-editor' in '/github/workspace/node_modules/@babylonjs/inspector/dist'
Parsed request is a module
using description file: /github/workspace/node_modules/@babylonjs/inspector/package.json (relative path: ./dist)
Field 'browser' doesn't contain a valid alias configuration
resolve as module
/github/workspace/node_modules/@babylonjs/inspector/dist/node_modules doesn't exist or is not a directory
/github/workspace/node_modules/@babylonjs/inspector/node_modules doesn't exist or is not a directory
/github/workspace/node_modules/@babylonjs/node_modules doesn't exist or is not a directory
/github/workspace/node_modules/node_modules doesn't exist or is not a directory
I think from other topics in the past that this might be a packaging issue or parsing issue with the NPM packages. Any insights (ed: @RaananW)?
Ed: I just tried with the latest BJS packages and same thing
@RaananW has moved everything to peer dependencies you now need to have explicit dev dep in your package for previous hidden ones like loaders, gltf-interfaces and gui
Hmm I thought that had been released a while back, and this just started happening. If this was introduced recently, would this be considered a breaking change, as anyone who’d written code against prior version would now break?
We probably needs some kind of bigger announcement as I have seen the issue a couple time this week in the forum
I was actually thinking of a NPM script that could be added to the package that prints out a warning to the effect when the user does a
npm i or equiv.
More advanced, we could have an upgrade script that, when executed in the context of a package upgrade, will either inject necessary refs to avoid breaking existing code or otherwise take action on behalf of the user to avoid breaking their stuff.
thoughts on that?
Sorry for multiple posts, but I can’t figure out why it works locally when I build it but fails in the GH action. The index.js file has these imports (nothing has changed, remember)
and my package.json already has those broken out as dev deps (along with the other @babylonjs packages not shown):
"@babylonjs/core": "^5.1 < 6.0.0",
"@babylonjs/gui": "^5.1 < 6.0.0",
"@babylonjs/inspector": "^5.1 < 6.0.0",
"@babylonjs/loaders": "^5.1 < 6.0.0",
I don’t think I’m missing anything, and sorry to hammer it again - the build works normally on my local machine, even after doing a
It’s not clear to me what I should change at this point, unfortunately.
@RaananW: Do you mind writing down a quick doc page to explain what to do with dev dependencies? We are getting the question quite often now
Is there a message that’s telling you that or is that coming from somewhere else? I didn’t see any mention of missing that package or anything resembling that one anywhere.
I checked my package-lock.json and it appears it does appear in there although I wonder if the issue wasn’t because of this other package versioning I read about:
I resolved this by doing what the error message implied: installing the @babylonjs/gui-editor package as a dev-dependency. That’s it
So, there should be a message! npm should inform you that you have missing peer dependencies. I wonder - was there any warning from npm?
No, nothing except the error message that it couldn’t resolve the deps!
npm disappoints time and time again.
I’ll check that. There should have been a warning that some peer dependencies are not resolved. This had to come directly from npm, as they are defined but not installed.
I’ll assign myself and check it. Thanks!
Would you be able to share the state of the project where it failed?
Sure no problem! Can even share it after I added the gui editor dev dep.
Here’s the last failed commit
and here’s the first successful build after that
I can’t seem to reproduce this. I checked out this specific commit, ran npm install, and have managed to build without an issue. I also can see both
babylonjs-gltf2interface in the package-lock file, so an
npm install should have installed them correctly. Am I missing something?
Yeah I wasn’t able to reproduce it on my local machine either, but reliably could in the GH Action Runner.
Only difference I cam think of is Linux on the runner vs windows local?
good call. I’ll try on ubuntu. but if that’s the case I will be even more disappointed in npm, and then we will have serious trust issues, and then I will have to start looking for a different package manager, and then npm will stop talking to me, and I will eventually have to apologize.
BTW - there was a known issue on linux exactly between 5.10 and 5.12. It was fixed in 15.12.1. could be related to that. I wonder if it would happen with a newer version on linux.