ошибка
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'setX')
 в коде:
import * as THREE from 'three';
import Stats from 'three/addons/libs/stats.module.js';
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';

async function loadShaderFile(url) {
	const response = await fetch(url);
	const shaderCode = await response.text();
	return shaderCode;
}

async function main() {

    // Создаем загрузчик gltf
    const loader = new GLTFLoader();
    loader.load(
        'card3.glb',
        async (gltf) => {
            const phone = gltf.scene;
            let container, stats, clock;
            
            let camera, scene, renderer;
            
            let line;
            
            const segments = 1000;
            const r = 2;
            let t = 0;
            
            init();
            scene.add(phone);
            phone.scale.set(1.0,1.0,1.0);

            const light = new THREE.AmbientLight( 0x404040 ); // soft white light
            scene.add( light );
        
        async function init() {
            
            container = document.getElementById( 'container' );
            
            camera = new THREE.PerspectiveCamera( 27, window.innerWidth / window.innerHeight, 1, 4000 );
            camera.position.z = 10;
            
            scene = new THREE.Scene();
            
            clock = new THREE.Clock();
            const shaderCode = await loadShaderFile('frag.glsl');
            const geometry = new THREE.BufferGeometry();
            //const material = new THREE.LineBasicMaterial( { vertexColors: true } );
            const texture2 = new THREE.TextureLoader().load('logoGradient2.png');
            let uTime = 0;
            let uniforms = {
                uTime: {
                    type: 'f',
                    value: 0.0
                },
                thickness: {
                    type: 'f',
                    value: 3.0
                },
                mouseCoord: {
                    type: 'v3',
                    value: new THREE.Vector3()
                },
                mouseCoord: {
                    type: 'v3',
                    value: new THREE.Vector3()
                },
                tex: {
                    type: 't',
                    value: texture2
                },
                opacity: {
                    type: 'f',
                    value: 1.0
                },
                res: {
                    type: 'v2',
                    value: new THREE.Vector2(window.innerWidth, window.innerHeight)
                },
                u_sec1: { type: "f", value: 0.0 },
                u_sec2: { type: "f", value: 0.0 },
                directionalLightColor: { value: new THREE.Color(0xffffff) },
                directionalLightPosition: { value: new THREE.Vector3(1, 1, 1) },
                ambientLightColor: { value: new THREE.Color(0x222222) },
            };
            const material = new THREE.ShaderMaterial({
                side: THREE.DoubleSide,
                fragmentShader: shaderCode,
                vertexShader: `
                attribute vec3 color;
                varying vec3 vColor;
                attribute float vertexID;
                varying float vVertexID;
                varying vec3 vPosition;
                
                void main() {
                    vColor = color;
                    vPosition = position;
                    vColor = color;
                    // Прочие операции трансформации вершин
                    gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
                }`,
                alphaToCoverage: true,
                uniforms: uniforms
            })
            uniforms.mouseCoord.value.z = 50;
            const positions = [];
            const colors = [];

            const geometryL = new THREE.BufferGeometry();
            const materialL = new THREE.LineBasicMaterial({ color: 0xffffff });

            const points = [];
            geometry.setFromPoints(points);
            
            const line = new THREE.Line(geometry, material);
            scene.add(line);
            line.geometry.attributes.color.setX(0, 1);
            line.geometry.attributes.color.setY(0, 0);
            line.geometry.attributes.color.setZ(0, 0);
            
            line.geometry.attributes.color.needsUpdate = true;
            
            const redMaterial = new THREE.LineBasicMaterial({ color: 0xff0000 });

            // Присвоим красный материал первой части линии
            line.geometry.attributes.color.array[0] = 1;
            line.geometry.attributes.color.array[1] = 0;
            line.geometry.attributes.color.array[2] = 0;

            line.geometry.attributes.color.needsUpdate = true;

            
            for ( let i = 0; i < segments; i ++ ) {
                
                const x = Math.random() * r - r / 2;
                const y = Math.random() * r - r / 2;
                const z = Math.random() * r - r / 2;
                
                // positions
                
                positions.push( x, y, z );
                
                // colors
                
                colors.push( ( x / r ) + 0.5 );
                colors.push( ( y / r ) + 0.5 );
                colors.push( ( z / r ) + 0.5 );
                
            }
            
            geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( positions, 3 ) );
            geometry.setAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3 ) );
            const vertexID = [0, 1];
            geometry.setAttribute('vertexID', new THREE.Float32BufferAttribute(vertexID, 1));
            geometry.computeBoundingSphere();
            
            // line = new THREE.Line( geometry, material );
            // scene.add( line );
            const lineSegments = new THREE.LineSegments(geometry, material);
            scene.add(lineSegments);
            lineSegments.material.uniforms.thickness.value = 3.0;

            //
            
            renderer = new THREE.WebGLRenderer();
            renderer.setPixelRatio( window.devicePixelRatio );
            renderer.setSize( window.innerWidth, window.innerHeight );
            renderer.useLegacyLights = false;
            
            container.appendChild( renderer.domElement );
            
            //
            
            stats = new Stats();
            container.appendChild( stats.dom );
            
            //
            
            window.addEventListener( 'resize', onWindowResize );
            const controls = new OrbitControls(camera, renderer.domElement);
        controls.enableDamping = true;
        controls.dampingFactor = 0.05;
        scene.add(controls.target);
        function animate() {
            requestAnimationFrame( animate );
            controls.update();
            uTime += 0.01;
            uniforms.uTime.value = uTime;
            uniforms.mouseCoord.value.x = Math.sin(uTime) / 2 + 0.5;
            uniforms.mouseCoord.value.y = Math.cos(uTime) / 2 + 0.5;
            render();
            stats.update();

            line.geometry.attributes.color.array[0] -= 0.01;
            line.geometry.attributes.color.array[1] += 0.01;
            line.geometry.attributes.color.array[2] += 0.01;
          
            line.geometry.attributes.color.needsUpdate = true;
            
        }
        animate()
        }
        
        function onWindowResize() {
            
            camera.aspect = window.innerWidth / window.innerHeight;
            camera.updateProjectionMatrix();
            
            renderer.setSize( window.innerWidth, window.innerHeight );
            
        }
        //
        
        
        function render() {
            
            const delta = clock.getDelta();
            const time = clock.getElapsedTime();
            
            t += delta * 0.5;
            
            
            renderer.render( scene, camera );
            
        }
        
        
    }    
    );    
    
    
};
main()