[SOLVED]Cannot Package my game. Getting these error please help. Game works with no errors in editor

UATHelper: Packaging (Windows): LogInit: Display:
UATHelper: Packaging (Windows): LogInit: Display: Warning/Error Summary (Unique only)
UATHelper: Packaging (Windows): LogInit: Display: -----------------------------------
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error: begin: stack for UAT
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error: === Handled ensure: ===
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error:
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error: Ensure condition failed: AttachmentRules.LocationRule == EAttachmentRule::KeepRelative && AttachmentRules.RotationRule == EAttachmentRule::KeepRelative && AttachmentRules.ScaleRule == EAttachmentRule::KeepRelative [File:D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\Components\SceneComponent.cpp] [Line: 1851]
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error: AttachToComponent when called from a constructor is only setting up attachment and will always be treated as KeepRelative. Consider calling SetupAttachment directly instead.
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error: Stack:
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error: [Callstack] 0x00007ffbfd90117c UnrealEditor-Engine.dll!UnknownFunction []
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error: [Callstack] 0x00007ffbdcda2422 UnrealEditor-illusion.dll!ADynamicMaterial::ADynamicMaterial() [D:\Education\Unreal Projects\ILLUSION UE 4.27\Source\illusion\DynamicMaterial.cpp:15]
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error: [Callstack] 0x00007ffc21cec44d UnrealEditor-CoreUObject.dll!UnknownFunction []
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error: [Callstack] 0x00007ffc21fc04dd UnrealEditor-CoreUObject.dll!UnknownFunction []
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error: [Callstack] 0x00007ffc21fa030b UnrealEditor-CoreUObject.dll!UnknownFunction []
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error: [Callstack] 0x00007ffc21e582a5 UnrealEditor-CoreUObject.dll!UnknownFunction []
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error: [Callstack] 0x00007ffc189ba5c2 UnrealEditor-Core.dll!UnknownFunction []
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error: [Callstack] 0x00007ffc189de937 UnrealEditor-Core.dll!UnknownFunction []
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error: [Callstack] 0x00007ffc95a7aaf6 UnrealEditor-Projects.dll!UnknownFunction []
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error: [Callstack] 0x00007ffc95a7ae31 UnrealEditor-Projects.dll!UnknownFunction []
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error: [Callstack] 0x00007ff6f9b353cb UnrealEditor-Cmd.exe!UnknownFunction []
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error: [Callstack] 0x00007ff6f9b3866e UnrealEditor-Cmd.exe!UnknownFunction []
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error: [Callstack] 0x00007ff6f9b30bbd UnrealEditor-Cmd.exe!UnknownFunction []
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error: [Callstack] 0x00007ff6f9b30e8a UnrealEditor-Cmd.exe!UnknownFunction []
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error: [Callstack] 0x00007ff6f9b33c4d UnrealEditor-Cmd.exe!UnknownFunction []
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error: [Callstack] 0x00007ff6f9b45564 UnrealEditor-Cmd.exe!UnknownFunction []
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error: [Callstack] 0x00007ff6f9b4788a UnrealEditor-Cmd.exe!UnknownFunction []
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error: [Callstack] 0x00007ffcabfe54e0 KERNEL32.DLL!UnknownFunction []
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error: [Callstack] 0x00007ffcacec485b ntdll.dll!UnknownFunction []
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Error: end: stack for UAT
UATHelper: Packaging (Windows): LogInit: Display: LogOutputDevice: Warning:
UATHelper: Packaging (Windows): Script Stack (0 frames):
UATHelper: Packaging (Windows): LogInit: Display:
UATHelper: Packaging (Windows): LogInit: Display: Failure - 27 error(s), 1 warning(s)
UATHelper: Packaging (Windows): LogInit: Display:
UATHelper: Packaging (Windows): Execution of commandlet took:  7.57 seconds
UATHelper: Packaging (Windows): LogShaderCompilers: Display: ================================================
UATHelper: Packaging (Windows): LogShaderCompilers: Display: === FShaderJobCache stats ===
UATHelper: Packaging (Windows): LogShaderCompilers: Display: Total job queries 0, among them cache hits 0 (0.00%)
UATHelper: Packaging (Windows): LogShaderCompilers: Display: Tracking 0 distinct input hashes that result in 0 distinct outputs (0.00%)
UATHelper: Packaging (Windows): LogShaderCompilers: Display: RAM used: 0.00 MB (0.00 GB) of 1638.40 MB (1.60 GB) budget. Usage: 0.00%
UATHelper: Packaging (Windows): LogShaderCompilers: Display: === Shader Compilation stats ===
UATHelper: Packaging (Windows): LogShaderCompilers: Display: Shaders Compiled: 0
UATHelper: Packaging (Windows): LogShaderCompilers: Display: Jobs assigned 0, completed 0 (0.00%)
UATHelper: Packaging (Windows): LogShaderCompilers: Display: Time at least one job was in flight (either pending or executed): 0.00 s
UATHelper: Packaging (Windows): LogShaderCompilers: Display: ================================================
UATHelper: Packaging (Windows): Took 13.8334846s to run UnrealEditor-Cmd.exe, ExitCode=1
UATHelper: Packaging (Windows): ERROR: Cook failed.
UATHelper: Packaging (Windows):        (see C:\Users\abhig\AppData\Roaming\Unreal Engine\AutomationTool\Logs\D+Softwares+Epic+Games+UE_5.0\Log.txt for full exception trace)
UATHelper: Packaging (Windows): AutomationTool executed for 0h 0m 16s
UATHelper: Packaging (Windows): AutomationTool exiting with ExitCode=25 (Error_UnknownCookFailure)
UATHelper: Packaging (Windows): Updating environment variables set by a Turnkey sub-process
UATHelper: Packaging (Windows): The system cannot find the path specified.
UATHelper: Packaging (Windows): The system cannot find the path specified.

I saw some error in above saying ADynamicMaterial. but dont know what its saying. but here’s my code for DynamicMaterial

// Fill out your copyright notice in the Description page of Project Settings.


#include "DynamicMaterial.h"

// Sets default values
ADynamicMaterial::ADynamicMaterial()
{
 	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;
	CubeRoot = CreateDefaultSubobject < USceneComponent >(TEXT("CubeRoot"));
	RootComponent = CubeRoot;
	CubeMesh = CreateDefaultSubobject < UStaticMeshComponent > (TEXT("CubeMesh"));
	CubeMesh -> AttachToComponent(CubeRoot,FAttachmentTransformRules::SnapToTargetNotIncludingScale);
	CubeTrigger = CreateDefaultSubobject<UBoxComponent>(TEXT("CubeTrigger"));
	CubeTrigger-> SetWorldScale3D(FVector(1.0f,1.0f,1.0f));
	CubeTrigger-> OnComponentBeginOverlap.AddDynamic(this, &ADynamicMaterial::OnPlayerTriggerGlow);
	CubeTrigger -> OnComponentEndOverlap.AddDynamic(this, &ADynamicMaterial::OnPlayerExitGlow);
	CubeTrigger-> AttachToComponent(CubeRoot, FAttachmentTransformRules::SnapToTargetNotIncludingScale);
	GlowAmount = 1.0f;
}

// Called when the game starts or when spawned
void ADynamicMaterial::BeginPlay()
{
	Super::BeginPlay();
	
}

// Called every frame
void ADynamicMaterial::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);

	UMaterialInstanceDynamic* RustMaterialInstance = CubeMesh->CreateDynamicMaterialInstance(0);
	if (RustMaterialInstance != NULL) //apparently can use NULL too
		{
		RustMaterialInstance->SetScalarParameterValue(FName("GlowAmount"), GlowAmount);
		}
}

void ADynamicMaterial::OnPlayerTriggerGlow(UPrimitiveComponent* OverlappedComp, AActor* OtherActor,
	UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
	bGlowEffectTriggered = true;
	GlowAmount = 0.0f;
}

void ADynamicMaterial::OnPlayerExitGlow(UPrimitiveComponent* OverlappedComp, AActor* OtherActor,
	UPrimitiveComponent* OtherComp, int32 OtherBodyIndex)
{
	bGlowEffectTriggered = false;
	GlowAmount = 1.0f;
}

Solved. Had to change AttactToComponent to SetUpAttachment wherever i used it.