Repository navigation
Build fails with Cannot redefine property: File using Node 20.6.0 #25782
Description
Activity
nodejs/node#49497 sounds like it could cause this behavior. I noticed that the
@babel/core/lib/index.jsfile is executed twice, and fails the second time becauseexportsis already populated. That would match the behavior described in the node issue.For the sake of completeness, here is the babel issue: babel/babel#15927
Reacted by Peter BenkoHi, thanks for reporting this. As you mentioned this is an upstream issue for an unsupported version yet.
- added a commit that references this issue
on Sep 6, 2023 the problem is the version of Node. downgrade it to 16.14.2
Reacted by Zac and InukI don't know if it helps but I had the same issue with Nodev20.6.0and NPM9.8.1but it was fixed by upgrading NPM to10.0.0for the same version of NodeEdit: my bad, Nx cache was involved and downgrading Node to
v18.13.0was what fixed the issueReacted by vaisakh babu, Zach Loza, Inuk, Randy Ochoa and dcrowley-somJust encountered this with the latest node on GitLab pages. Didnt happen before.
This issue is not related to NPM and not even related to Angular CLI.
node 20.6 breaks Babel, Babel breaks Angular CLI.Reacted by Spacefish, Jens Kleikamp, TheHolocoder, Connor Bär, Akkora, neripark, amajmistov, Jorgi Bolonhezi, James Gennoy, Sam Bunting and 12 moreI had the same issue this morning on my dockerized React & Vite app.

I was using
node:latestimage in my Dockerfile. I checked the Node version of the latest tag is upgraded tov20.610 hours ago.
So I downgraded the node image tonode:18-alpine3.17and it works now. I believe the node.js team fix this soon.Reacted by Bariscan Sargin, Emre, Paul Boutillier, Luca Campana, fonzane, Jorgi Bolonhezi, talinedacosta, Gilberto Toledo, Nick Harbaugh, Zach Loza and 8 moreReacted by Paul Boutillier, Jorgi Bolonhezi, Gilberto Toledo and Zach LozaReacted by Paul Boutillier, Jorgi Bolonhezi, Gilberto Toledo, Zach Loza and David AmbukaReacted by Bariscan Sargin, Paul Boutillier, Jorgi Bolonhezi, Gilberto Toledo and Zach Loza- added a commit that references this issue
on Sep 6, 2023 Mine still didn't work @minikdev even after changing the node image
FROM node:18-alpine3.17 AS build@ogabz12345 I just tried to build it and it worked, you might need to rebuild your image,
you can usedocker-compose up --buildto rebuild it

@minikdev Did the exact same thing, still getting same error and it literally started this morning. I also use
FROM nginx:latest as servecan this be an issue as well?I encountered the same issue. After switching in my Dockerfile from
FROM node as build
to
FROM node:18-alpine3.17 as build
the error is gone.I had same issue and switched this in my Dockerfile:
FROM node:20-alpine AS buildto
FROM node:18-alpine3.17 AS buildand now it works fine!
8 remaining items
Switching from Node 20.6.0 to Node 18.17.1 fixed the problem for me. nvm makes it easy to change Node versions.
- added a commit that references this issue
on Sep 7, 2023 I had same issue. Punishment for using latest node version in Dockerfile :D
We added a workaround for this in
@babel/core,@babel/traverseand@babel/types7.22.17Reacted by Jan Melcher, Alex and SlashNephy- added a commit that references this issue
on Sep 10, 2023 - added 2 commits that reference this issue
on Sep 10, 2023 I had the same problem in a project and I tried with version 20, the project didn't compile with prayer or macumba, much less with voodoo, I had to downgrade to version 18 and then it worked.
@marquessbr You can also use 20.6.1. Only 20.6.0 had this bug.
Reacted by Armando Marques Sobrinho@marquessbr You can also use 20.6.1. Only 20.6.0 had this bug.
cool!
Thanks man, maybe I'll need to use a newer version of node because my professor is just giving classes about signals and NgRx, but since I'm using NVM, it's easy to migrate between versions when I need to.@marquessbr You can also use 20.6.1. Only 20.6.0 had this bug.
thank you,
I have a problem like this.
It a realy work
👍Reacted by Armando Marques SobrinhoTry changing you node version. I mean you can downgrade and try.
angular-automatic-lock-bot commented
on Nov 3, 2023 More actionsThis issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
- locked and limited conversation to collaborators
on Nov 3, 2023
Command
build
Is this a regression?
The previous version in which this bug was not present was
No response
Description
If you use Node 20.6.0 (released yesterday) to build an Angular 16 papp, the following error occurs:
I know Node 20 is not officially supported at the moment and it's not yet in LTS, but it worked before (in 20.5.1) and maybe it's good too approach this issue early. The relevant changes in Node might get backported to node 18.
I also don't know yet if this is an issue in Node, babel or angular-cli. In either case, it might be good to have this as a tracking issue.
Also affects Angular 15 and Angular 17.0.0-next.0.
Minimal Reproduction
Exception or Error
Your Environment
Anything else relevant?
No response