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

ERROR [I18nService] parsing translation error in 10.3.2 #2558

Open
2 of 4 tasks
michaltalaga opened this issue Mar 26, 2024 · 12 comments
Open
2 of 4 tasks

ERROR [I18nService] parsing translation error in 10.3.2 #2558

michaltalaga opened this issue Mar 26, 2024 · 12 comments

Comments

@michaltalaga
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

after updating to 10.3.2 our project fails to process translation files which worked all the way up until now.

Minimum reproduction code

https://github.com/nestjs/nest-cli/

Steps to reproduce

our repo is private
steps to repro
npm install
npm run start:dev

Expected behavior

works as last week but it fails
[Nest] 50208 - 03/26/2024, 4:27:27 PM ERROR [I18nService] parsing translation error
[Nest] 50208 - 03/26/2024, 4:27:27 PM ERROR [I18nService] Error: ENOENT: no such file or directory, stat 'xxxxxxxxxxxx\src\backend\dist\i18n'
[Nest] 50208 - 03/26/2024, 4:27:27 PM ERROR [I18nService] parsing translation error
[Nest] 50208 - 03/26/2024, 4:27:27 PM ERROR [I18nService] Error: ENOENT: no such file or directory, scandir 'xxxxxxxxxxxx\src\backend\dist\i18n'

This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
Error: ENOENT: no such file or directory, stat 'xxxxxxxxxxxx\src\backend\dist\i18n'

Package version

10.3.2

NestJS version

10.3.4

Node.js version

18.19.1

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

@micalevisk
Copy link
Member

Please provide a minimum reproduction repository. You can start one by running npm init nest in your terminal

why reproductions are required

@michaltalaga
Copy link
Author

further investigation shows breaking change was introduced in
https://github.com/nestjs/nest-cli/releases/tag/10.2.0

@michaltalaga
Copy link
Author

narrowed it down to:
https://github.com/michaltalaga/nestjs-cli-i18n-issue

git clone
npm install // this will use "@nestjs/cli": "10.2.0",
npm run start:dev

it will fail

git clone
// change to "@nestjs/cli": "10.1.18",
npm install
npm run start:dev

it will work

@michaltalaga
Copy link
Author

may be a red herring but it has something to do with nest-cli.json

@micalevisk
Copy link
Member

I just tested your repository with both versions and got the same output:

image

so that might be related with Windows. I tested on linux

@michaltalaga
Copy link
Author

that is possible. it worked till 10.1.18 - no issues tho

if I use the default nest-cli.json
{
"$schema": "https://json.schemastore.org/nest-cli",
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"compilerOptions": {
"deleteOutDir": true
}
}
it breaks even on 10.1.18

so something around those options must be causing the problem
is there a way I can do verbose logging maybe?

@micalevisk
Copy link
Member

yeah, now I got that error

Error: ENOENT: no such file or directory, scandir '/tmp/nestjs-cli-i18n-issue/dist/i18n/'

@micalevisk
Copy link
Member

micalevisk commented Mar 26, 2024

but it looks like to be related with nestjs-i18n package or due to missing assets (which is expected due to your nest cli config)

unless you manage to find a working version of @nestjs/cli, of course

@micalevisk
Copy link
Member

just found this: toonvanstrijp/nestjs-i18n#96

isn't the same thing?

@michaltalaga
Copy link
Author

tried out. no luck

@micalevisk
Copy link
Member

to recap, it works when you have that assets as in your repository, in your nest-cli.json?

@michaltalaga
Copy link
Author

to recap:

starting in version 10.2.0 following nest-cli.json fails on windows

{
  "language": "ts",
  "collection": "@nestjs/schematics",
  "sourceRoot": "src",
  "compilerOptions": {
    "assets": [
      "**/*.html",
      "**/*.otf",
      "i18n/**/*",
      "**/*.json"
    ]
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants