gltfjsx icon indicating copy to clipboard operation
gltfjsx copied to clipboard

Running npx gltfjsx Model.gltf fails with Error: Invalid hook call.

Open synergyseeker opened this issue 3 years ago • 5 comments

When running npx gltfjsx Model.gltf against any gltf model it fails. It returns this Error.

ERROR Objects are not valid as a React child (found: Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons: 1. You might have mismatching versions of React and the renderer (such as React DOM) 2. You might be breaking the Rules of Hooks 3. You might have more than one copy of React in the same app See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.). If you meant to render a collection of children, use an array instead. in ink-text (created by Text) in Text in ink-box (created by Box) in Box in App in App in InternalApp

-throwOnInvalidObje (/Users/richardmattka/.npm/_npx/16b3f312213fced0/node_modu ctType les/react-reconciler/cjs/react-reconciler.development.js:45 24:15) -createChil (/Users/richardmattka/.npm/_npx/16b3f312213fced0/node_modules/reac t-reconciler/cjs/react-reconciler.development.js:4757:7) -reconcileChildren (/Users/richardmattka/.npm/_npx/16b3f312213fced0/node_modul rray es/react-reconciler/cjs/react-reconciler.development.js:5008 :25) -reconcileChildFi (/Users/richardmattka/.npm/_npx/16b3f312213fced0/node_module ers s/react-reconciler/cjs/react-reconciler.development.js:5374:1 4) -reconcileChild (/Users/richardmattka/.npm/_npx/16b3f312213fced0/node_modules/ en react-reconciler/cjs/react-reconciler.development.js:7865:28) -updateHostCompo (/Users/richardmattka/.npm/_npx/16b3f312213fced0/node_modules ent /react-reconciler/cjs/react-reconciler.development.js:8387:3)

-beginWork$ (/Users/richardmattka/.npm/_npx/16b3f312213fced0/node_modules/reac t-reconciler/cjs/react-reconciler.development.js:9969:14) -Object.invokeGuardedCa (/Users/richardmattka/.npm/npx/16b3f312213fced0/node lbackImpl modules/react-reconciler/cjs/react-reconciler.developme nt.js:11563:10) -invokeGuardedCal (/Users/richardmattka/.npm/_npx/16b3f312213fced0/node_module back s/react-reconciler/cjs/react-reconciler.development.js:11740: 31) -beginWork$ (/Users/richardmattka/.npm/_npx/16b3f312213fced0/node_modules/reac 1 t-reconciler/cjs/react-reconciler.development.js:15778:7)

synergyseeker avatar Sep 24 '21 13:09 synergyseeker

edit: You don't get the issue at all if you install gltfjsx globally instead of using npx. I'm not sure why wiping my npx cache alone didn't solve it too.

npm i -g gltfjsx

As a temporary workaround, I've found that an older version of gltfjsx run on the same file works as expected.

npx [email protected] model.gltf

That version isn't necessarily the latest one that doesn't have this issue, but it is one that worked. I didn't try them all.

jonczeck avatar Oct 06 '21 18:10 jonczeck

i think i have to remove ink, it's probably not worth it just so have some colored console output.

drcmda avatar Oct 06 '21 22:10 drcmda

edit: You don't get the issue at all if you install gltfjsx globally instead of using npx. I'm not sure why wiping my npx cache alone didn't solve it too.

npm i -g gltfjsx

As a temporary workaround, I've found that an older version of gltfjsx run on the same file works as expected.

npx [email protected] model.gltf

That version isn't necessarily the latest one that doesn't have this issue, but it is one that worked. I didn't try them all.

Thank you. It worked for me!

ITBoomBKStudio avatar Jan 26 '22 00:01 ITBoomBKStudio

That didn't work for me. :-\

jeffscottward avatar Nov 07 '22 17:11 jeffscottward

This also didn't work for me as well. After hours of trying to nvm different versions, removing and re-installing npm, nvm, node... ect I still get this error. Powershell, gitbash, cmd... I used the online converter which worked but this drove me nuts to figure out.

I finally was able to solve it. For me it was my file location, my directory had a file location with space in it and some other issue the shell didn't like. I move the file to my desktop and the conversion worked. So I would try that @jeffscottward

chillywilson avatar Dec 10 '22 05:12 chillywilson