最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

node.js - Why am I getting "Object.defineProperty(exports, "File", {" - Stack Overflow

programmeradmin3浏览0评论

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

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论