Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot redefine property: File (nodejs 20.6.0 issue) #14309

Closed
7 tasks done
qdraw opened this issue Sep 6, 2023 · 1 comment
Closed
7 tasks done

Cannot redefine property: File (nodejs 20.6.0 issue) #14309

qdraw opened this issue Sep 6, 2023 · 1 comment

Comments

@qdraw
Copy link

qdraw commented Sep 6, 2023

Describe the bug

I have nodejs specific issue that only gives problems with the latest release, in older versions it does work. I Couldn't find any other tickets with the issue.

npm create vite@latest
✔ Project name: … vite-project
✔ Select a framework: › React
✔ Select a variant: › TypeScript
cd vite-project
npm run build
> [email protected] build
> tsc && vite build

failed to load config from ~/Desktop/vite-project/vite.config.ts
error during build:
TypeError: Cannot redefine property: File
    at Function.defineProperty (<anonymous>)
    at Object.<anonymous> (~/Desktop/vite-project/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> (~/Desktop/vite-project/node_modules/@babel/core/lib/config/helpers/config-api.js:16:14)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)

It does not work with: node v20.6.0, but it does work with 20.5.1
So It could also be a nodejs / npm specific issue.

Reproduction

see-discription

Steps to reproduce

npm create vite@latest
✔ Project name: … vite-project
✔ Select a framework: › React
✔ Select a variant: › TypeScript
cd vite-project
npm run build
> [email protected] build
> tsc && vite build

failed to load config from~/Desktop/vite-project/vite.config.ts
error during build:
TypeError: Cannot redefine property: File
    at Function.defineProperty (<anonymous>)
    at Object.<anonymous> (~/Desktop/vite-project/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> (~/Desktop/vite-project/node_modules/@babel/core/lib/config/helpers/config-api.js:16:14)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)

System Info

It does work on:

  System:
    OS: macOS 13.5.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 56.91 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.5.1 - ~/.nvm/versions/node/v20.5.1/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 9.8.0 - ~/.nvm/versions/node/v20.5.1/bin/npm
    Watchman: 2023.08.07.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 116.0.5845.179
    Safari: 16.6
  npmPackages:
    @vitejs/plugin-react: ^4.0.3 => 4.0.4
    vite: ^4.4.5 => 4.4.9


And it fails on:
    Node: 20.6.0 - ~/.nvm/versions/node/v20.6.0/bin/node
    npm: 9.8.1 - ~/.nvm/versions/node/v20.6.0/bin/npm

Used Package Manager

npm

Logs

npm run build -- --debug

[email protected] build
tsc && vite build --debug

failed to load config from /Desktop/vite-project/vite.config.ts
error during build:
TypeError: Cannot redefine property: File
at Function.defineProperty ()
at Object. (
/Desktop/vite-project/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. (~/Desktop/vite-project/node_modules/@babel/core/lib/config/helpers/config-api.js:16:14)
at Module._compile (node:internal/modules/cjs/loader:1241:14)

Validations

@qdraw qdraw changed the title Cannot redefine property: File Cannot redefine property: File (nodejs 20.6.0 issue) Sep 6, 2023
@bluwy
Copy link
Member

bluwy commented Sep 6, 2023

Duplicate of #14299

@bluwy bluwy marked this as a duplicate of #14299 Sep 6, 2023
@bluwy bluwy closed this as not planned Won't fix, can't repro, duplicate, stale Sep 6, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Sep 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants