Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'backend')

Hi everyone, I am experiencing the following error in my code: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'backend'). This error is occurring when I am trying to access the ‘backend’ property of an object, but it is returning as undefined. I have checked my code multiple times and cannot figure out why this is happening.

Here is the error:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'backend')
    at Engine.moveData (engine.ts:426:1)
    at DataStorage.get (backend.ts:55:1)
    at MathBackendCPU.incRef (backend_cpu.ts:106:1)
    at Object.reshape [as kernelFunc] (Reshape.ts:40:1)
    at kernelFunc (engine.ts:646:1)
    at engine.ts:712:1
    at Engine.scopedRun (engine.ts:480:1)
    at Engine.runKernelFunc (engine.ts:708:1)
    at Engine.runKernel (engine.ts:553:1)
    at reshape_ (reshape.ts:60:1)

Dependencies:

 "@tensorflow/tfjs": "^4.1.0",
 "@tensorflow/tfjs-converter": "^4.1.0",
 "@tensorflow/tfjs-core": "^4.1.0",
 "@tensorflow/tfjs-node": "^1.7.4",

If anyone has experienced this error or has any suggestions on how to fix it, please let me know.

Can you show the code please @Mayukhdeep

Have you solved this issue?