Recently I used Shadcn on Next.js project.
I am not node on the latest version of node. I am currently on v20.6.0 however when you install Shadcn components I get if you are some past versions of code.
I fixed already by upgrading to latest version but I want to know why this happens or what is the output telling what is breaking specifically in babel?
C:\Users\lesli\AppData\Local\npm-cache\_npx\d66c5096c7023bfb\node_modules\@babel\core\lib\index.js:7
Object.defineProperty(exports, "File", {
^
TypeError: Cannot redefine property: File
at Function.defineProperty (<anonymous>)
at Object.<anonymous> (C:\Users\lesli\AppData\Local\npm-cache\_npx\d66c5096c7023bfb\node_modules\@babel\core\lib\index.js:7:8)
at Module._compile (node:internal/modules/cjs/loader:1241:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
at Module.load (node:internal/modules/cjs/loader:1091:32)
at Module._load (node:internal/modules/cjs/loader:938:12)
at Module.require (node:internal/modules/cjs/loader:1115:19)
at require (node:internal/modules/helpers:130:18)
at Object.<anonymous> (C:\Users\lesli\AppData\Local\npm-cache\_npx\d66c5096c7023bfb\node_modules\@babel\core\lib\config\helpers\config-api.js:16:14)
at Module._compile (node:internal/modules/cjs/loader:1241:14)
To fixed I found out you can downgrade to nvm use v20.5.1 or upgrade to latest verus of nodejs.
My question is why is this happening? What is going on inside of babel and Object.defineProperty