Problem:
When running node scripts/build-challenge-map-graphql.mjs on Windows, the script fails with an error:
Error building challenge map: Error: ENOENT: no such file or directory, mkdir 'C:\C:\Users\newto\dev\classroom\data'
at async mkdir (node:internal/fs/promises:859:10)
at async buildChallengeMapFromGraphQL (file:///C:/Users/newto/dev/classroom/scripts/build-challenge-map-graphql.mjs:161:5) {
errno: -4058,
code: 'ENOENT',
syscall: 'mkdir',
path: 'C:\\C:\\Users\\newto\\dev\\classroom\\data'
}
The script is incorrectly generating a path with two C:/ prefixes (e.g., C:\C:\Users...).
Expected Behavior:
- The script should correctly resolve file paths on all platforms (Windows, macOS, Linux).
- Directory creation and path handling should work regardless of the user's operating system, without duplicating path roots.
Steps to Reproduce:
- On a Windows machine, run
node scripts/build-challenge-map-graphql.mjs.
- Observe the ENOENT error with the double
C:/ path.
Suggested Solution:
- Use Node.js's built-in
path module (path.join/path.resolve) instead of manual string concatenation to construct file paths.
- Audit the script for any locations where paths are manually combined, and replace them with cross-platform-safe path handling.
Relevant File:
scripts/build-challenge-map-graphql.mjs
Problem:
When running
node scripts/build-challenge-map-graphql.mjson Windows, the script fails with an error:The script is incorrectly generating a path with two
C:/prefixes (e.g.,C:\C:\Users...).Expected Behavior:
Steps to Reproduce:
node scripts/build-challenge-map-graphql.mjs.C:/path.Suggested Solution:
pathmodule (path.join/path.resolve) instead of manual string concatenation to construct file paths.Relevant File:
scripts/build-challenge-map-graphql.mjs