Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

371
Visualizações
Nx Angular - no such file or directory, open 'd:\...\TheApp\Source\Angular.Apps/apps/app-client/src/environments/environment.prod.ts'

I've spent some time working on a PowerShell project to automate some builds of my C# and Angular apps which are based on @Nrwl NX monorepos. Prior to this everything worked fine, but when I try a simple:

nx build --baseHref=/apps/admin/ --deployUrl=/apps/admin/ --watch 

I now get the error

ENOENT: "no such file or directory, open 'd:\Projects\TheApp\Source\Angular.Apps/apps/the-client/src/environments/environment.prod.ts'" 

Problem: I assume it's looking for environment.prod.ts because the replaceFile section, but since I'm building in local dev I would have though it shouldn't do the replacement at all.
Also: It's looking for the APP-CLIENT environment file even though I'm building the APP-ADMIN app.

Some points that could have caused issues during my build automation project:

  1. I renamed all the app configurations in workspace.json. So for example "production" became "production-client1" which makes use of the environment.prod.client1.ts file during replacement

    "fileReplacements": [
    {
    "replace": "apps/app-admin/src/environments/environment.ts",
    "with": "apps/app-admin/src/environments/environment.prod.orgb.ts" }
    ],

  2. In 1) above I mentioned the file environment.prod.client1.ts which is originally the environment.prod.ts file. Since the error mentions that it can't find this file it could be that the problem is either here or that I should changed some additional configuration to make this work?

Final note: My powershell cmdlet calls the following command:

nx build portfolio-client --deleteOutputPath=false --baseHref=/apps/client/ --deployUrl=/apps/client/ --configuration=staging-client-client1 

And this works like a charm as does the admin app and the variations for each client. It's only during dev builds that I'm experiencing these issues.

Edit 1:
I created dummy files for environment.prod.ts and environment.staging.ts in the two "application" type projects that I have and this resolved the problem. These files are blank though so not sure why building for Dev/local isn't just working off the environment.ts file

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I found the answer in the comments of the following GitHub reported issue: "Error: ENOENT: no such file or directory" for deleted file #3370

What it came down to was that the Nrwl file file-hasher.js makes use of git hashes and since I had not committed those changes it was looking for an old filename. I resolved it by staging and committing all my changes on the current branch.

Looking further this seems to be a bug that was later fixed in Nx 10.0.2 and up, which we haven't upgraded to yet.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda