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
"Module not found" run-time error, if the project directory name contains non-ASCII characters #1868
Comments
Would you like to create a PR for this issue? |
I experienced the same issue, with a 'é' character in the path leading to the project. Windows, Nestjs 9.2.1, Node 18.13.0 |
The issue is located in The conversions in convertPath:
Anyway, as is the current implementation, if there is any change in the Not tested, but if the (note: I won't provide a fix/PR) |
Replace escaped unicode occurrences in text with their respective UTF-8 character. This enables the use of non-ASCII characters in the project path. Closes nestjs#1868
Unescape escaped unicode characters in file paths. Filepaths returned from TypeScript have their non-ASCII characters escaped. See https://www.github.com/microsoft/TypeScript/issues/36174 This enables the use of non-ASCII characters in the project path. Closes nestjs#1868
Let's track this here #2745 |
Is there an existing issue for this?
Current behavior
I get following error when I start the server:
Minimum reproduction code
https://github.com/retnag/nestjs-swagger-apostrophe-in-path-error
Steps to reproduce
cd
into it, and clone the reproduction code into it. The goal here is, to have a non-ASCII character in the full path of the projects Filenames.npm i
as usualnpm start
Key requirements provided by the linked repo:
Expected behavior
I would expect the server to start without the error. I spent hours figuring out what's going on here, tests ran fine. Typescript compilation runs fine. I have tracked down the error to the following line in the emitted code by typescript (file: dist/app.controller.js:31):
Notice the \u00E1s Unicode escape sequence in the file path string. Now the "Module not found" error makes sense, since this directory really doesn't exist....
Also, and this might be a separate Issue altogether, I would expect a relative path here, as this absolute path is only going to be valid on the developer machine, ergo the build will fail with this error on any other machine It's deployed to.
Package version
5.2.1
NestJS version
8.0.0
Node.js version
14.19.0
In which operating systems have you tested?
Other
This was successfully reproduced on another machine on Windows.
I guess this is not a high-priority issue, as a simple workaround would be not to use Unicode characters in your directory structure, but guys, its 2022 :'), things like this really shouldn't be an issue anymore, I just lost hours debugging this, as I never had suspected a user error, or a circular dependency somwhere. Please fix this.
BUT: the fact that there is a full, dev-environment relevant absolute path emittet there, which will break the server in a production environment, kinda seems like a dealbreaker to me!
The text was updated successfully, but these errors were encountered: