Fragment shader is not compiled

I was trying to add envMapping and I got this error:
THREE.WebGLProgram: shader error: 0 35715 false gl.getProgramInfoLog Fragment shader is not compiled.

RGBELoader = new THREE.RGBELoader()
    // .setPath( 'textures/equirectangular/' )
      function (hdrmap) {
        envmap = envmaploader.fromCubemap(hdrmap);
        texture = new THREE.CanvasTexture(new FlakesTexture());
        texture.wrapS = THREE.RepeatWrapping;
        texture.wrapT = THREE.RepeatWrapping;
        texture.repeat.x = 10;
        texture.repeat.y = 6;
            child.material.normalMap = texture
            child.material.envMap = envmap.texture

I have tried both RGBELoader and EXRLoader. I don’t know what the problem is. it’ll be great if anyone can help

classic three.js workflow usually compile shaders using materials properties.
however, material is not defined in your code extract.

I use the following code in the gltfLoader for updating the mesh material

model.traverse((mesh) => {
              if (!mesh.isMesh) return;

              var oldMaterial = mesh.material;

              mesh.material = new THREE.MeshPhongMaterial();


The error seem to come from your attempt to mix normalMap while using THREE.MeshBasicMaterial (wich does not support this property) On my quick test, your code work when it’s removed.

Yes, but the error still stands even if the material is changed to MeshPhongMaterial.