- assigned_to: emmanuel39hanks
Originally created by: emmanuel39hanks
Originally owned by: emmanuel39hanks
When running the napi ui command in a project, the /api/scan endpoint fails with an Invalid file path error on Windows. The issue occurs because the entrypoint path from the .napirc configuration file is passed as a Windows-style path (e.g., C:\\Users\\emmanuel\\...) to the endpoint.
This bug prevents the napi ui visualizer from scanning the entry point and displaying the codebase structure, making the feature unusable on Windows.
The /api/scan endpoint should correctly process the entrypoint path, regardless of whether it’s in Windows-style or Unix-style format, and return a valid response.
The /api/scan endpoint fails with the following response:
[
{
"code": "custom",
"message": "Invalid file path",
"path": ["entrypointPath"]
}
]
Normalize file paths to handle both Windows-style (C:\...) and Unix-style (/...) paths.
Use a library like path from Node.js to ensure consistent path handling.
On a Windows environment create a .napirc file with the following configuration:
:::json
{
"entrypoint": "src/index.js",
"out": "napi_dist"
}
Run the command:
:::bash
napi ui
Observe the generated config (e.g., http://localhost:3000/api/config) with Windows-style paths:
:::json
{
"entrypoint": "C:\Users\emmanuel\opensource\napi\examples\express\src\index.js",
"out": "C:\Users\emmanuel\opensource\napi\examples\express\napi_dist"
}
Check the /api/scan endpoint and see the Invalid file path error.
This bug blocks the ability to use then napi ui command on Windows. It affects Windows developers trying to scan their entrypoint and view their codebase in the visualizer.
Paste your .napirc below
{
"entrypoint": "src/index.js",
"out": "napi_dist"
}