-
Notifications
You must be signed in to change notification settings - Fork 312
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
(node:35442) Warning: require() of ES modules is not supported. #225
Comments
@aaronxowen CesiumJS was recently updated to ES6 so it's possible that's related to the warning. A few questions...
I'm not seeing any issues on my end after updating packages but there could be a few different factors at play. |
Originally I tried to use 13.2.0, but couldn't get it to run at all on the command line (macOS 10.14.6), so I switched to node 12.13.1 and it runs, but with those errors. I believe that the "ENOENT: no such file or directory" error is related to the .obj not referencing a mtl at all. I had exported the obj from Maya with materials turned off, so there were no "usemtl" or "mtllib" statements in the obj. I thought I'd be able to override the lack of mtl with specific mappings to external texture files like I do with Apple's python USDZ converter. If I run obj2gltf on an obj that references a mtl file and override with the flags for external texture map files, it appears to work correctly, but still throws the warning about require():
|
@aaronxowen we're tracking this from the cesium side - CesiumGS/cesium#8452 We hope to have a fix by the next Cesium release on Jan 2. |
CesiumJS 1.68.0 was released yesterday with the fix. I tested that obj2gltf now works with Node 13.12.0. |
I am trying to convert an obj that doesn't reference an mtl to GLB using PBR textures explicitly set by the option flags using the following command:
obj2gltf -i Monaco1-DrawerNightstand_82334_low_scaled.obj -o Monaco1-DrawerNightstand_82334_ClassicPaint_CoastalClear_PolishedNickel.glb -b --baseColorTexture Monaco1-DrawerNightstand_82334_ClassicPaint_CoastalClear_PolishedNickel_Albedo.jpg --normalTexture Monaco1-DrawerNightstand_82334_ClassicPaint_CoastalClear_PolishedNickel_Normal_OpenGL.png --metallicRoughnessOcclusionTexture Monaco1-DrawerNightstand_82334_ClassicPaint_CoastalClear_PolishedNickel_MetallicRoughnessOcclusionRGB.jpg
When run, I get this:
(node:35442) Warning: require() of ES modules is not supported. require() of /usr/local/lib/node_modules/obj2gltf/node_modules/cesium/index.js from /usr/local/lib/node_modules/obj2gltf/bin/obj2gltf.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules. Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /usr/local/lib/node_modules/obj2gltf/node_modules/cesium/package.json. ENOENT: no such file or directory, open '/Users/aaron/Desktop/GLTF_tests/iOS_Optimized/Monaco1-DrawerNightstand_82334_low_scaled.obj'
A GLB file is output, but doesn't seem to have the correct maps in place.
The text was updated successfully, but these errors were encountered: