Uncaught TypeError: material.onBuild is not a function

Dear all:

I did not do any change in my code.
However suddenly, It goes wrong.
May anyone tell me what happened ? thank you

It seems that library files are out of sync in your project. Please ensure that you are not including three.js more than once.


I got this error with a library/package that was using Three.js version 0.128.0 and another library that was using instead 0.126.1. Upgrading the Three.js version of this last to 0.128.0 solved the issue. If you need more infos look at this my PR Testing new ARnft and ARnft-threejs package by kalwalt · Pull Request #15 · kalwalt/ARnft-ES6-react · GitHub

1 Like


Thanks for pointing me to this thread.

I was using another library three-mesh-ui by @felixmariotto which was using v0.122.0 ( in its latest release) as a dependency which caused the issue mentioned here:

Updating the dependency to r129 in three-mesh-ui fixed the issue :slight_smile:



Which version of three-mesh-ui do you use ?
I updated the three.js dependancy version to r128 about a month ago, which seemed to fix the problem. The last three-mesh-ui version is 4.6.1.

1 Like

I was using version 4.5.1 :slight_smile:

1 Like