Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual studio code "ng serve" command fails with "Cannot redefine property: file"

I created an angular project in visual studio code(version 1.81.1). but when I try to run the program using "ng serve" command give below error.(Node version : 20.6.0,npm version : 10.0.0)

Cannot redefine property: File

This is the error message

Execution policies set as below

execution policies

Can give any reason for the issue?

like image 652
JagathNalin Avatar asked Mar 11 '26 22:03

JagathNalin


1 Answers

There is an issue with node 20.6 that breaks babel. The fix for node has landed but not been released yet.

  • issue for node
  • issue for Babel

Downgrading to any previous version of Node (below 20.6) will fix the issue.


Babel has introduced a workaround in 7.22.17 with #15947 with allow Angular to run with 20.6.

like image 138
Matthieu Riegler Avatar answered Mar 14 '26 12:03

Matthieu Riegler



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!