question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

gltf-transform cli cannot start with node16. Is there a certain node version which I have to use?

See original GitHub issue

Hi!

After running this command: npm install --global @gltf-transform/cli I would like to start the gltf-transform cli, but then this error appears:

ode:internal/modules/cjs/loader:1126
      throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
      ^

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /home/jota/.nvm/versions/node/v16.3.0/lib/node_modules/@gltf-transform/cli/node_modules/gl-matrix/dist/esm/vec3.js
require() of ES modules is not supported.
require() of /home/jota/.nvm/versions/node/v16.3.0/lib/node_modules/@gltf-transform/cli/node_modules/gl-matrix/dist/esm/vec3.js from /home/jota/.nvm/versions/node/v16.3.0/lib/node_modules/@gltf-transform/cli/node_modules/@gltf-transform/core/dist/core.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 vec3.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /home/jota/.nvm/versions/node/v16.3.0/lib/node_modules/@gltf-transform/cli/node_modules/gl-matrix/package.json.

To Reproduce

  1. Install node16
  2. Install gltf-transform cli with npm install --global @gltf-transform/cli
  3. Try to run gltf-transform
  4. See error

Expected behavior No error…

Versions:

  • Version: 0.12.15
  • Environment: Ubuntu 18.04

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
donmccurdycommented, Oct 5, 2021

I’ve just published v0.12.16, pinned to gl-matrix@~3.3.0. Hopefully that fixes the regression, but let me know if not!

Have also added integration test coverage for Node.js v16, which seems to be working fine.

1reaction
donmccurdycommented, Oct 5, 2021

The integration tests check Node.js v12 and v14 so probably those are the safest options. I’ll try adding v16 to the tests and see what happens – was v16 working before the gl-matrix dependency update for anyone?

It looks like gl-matrix has already gotten reports about this (https://github.com/toji/gl-matrix/issues/439) and are planning to revert 3.4.0 shortly. I’ll see about switching this project’s production dependencies to ~ instead of ^ as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

@gltf-transform/cli - npm
Start using @gltf-transform/cli in your project by running `npm i @gltf-transform/cli`. There is 1 other project in the npm registry using ...
Read more >
Use GLTF-transform merge command - node js script
I want to use the gltf-transform command ...
Read more >
Can I change the version of node.js my project uses?
Yes, you can do so by updating the engines field specified in the package.json project file. Currently, Glitch supports node.js versions 6.17.1 through ......
Read more >
CLI | glTF-Transform - Don McCurdy
Documentation for CLI in glTF-Transform, a glTF 2.0 SDK for JavaScript, TypeScript, and Node.js.
Read more >
Home | xeokit-convert
As such, some IFC models may not convert properly. ... Let's use the convert2xkt Node script to convert an IFC file to XKT...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found