Bug
npx impeccable detect <url> fails on Windows with:
Error: Browser script not found at C:\C:\Users\...\detect-antipatterns-browser.js
Note the doubled C:\C:\.
Cause
In src/detect-antipatterns.mjs, two locations construct the path to detect-antipatterns-browser.js using:
path.dirname(new URL(import.meta.url).pathname)
On Windows, new URL('file:///C:/foo/bar').pathname returns /C:/foo/bar (with a leading slash). When passed to path.join or path.resolve, Node prepends the drive letter again, producing C:\C:\....
Affected lines:
- ~L2690:
path.dirname(new URL(import.meta.url).pathname) (puppeteer scan path)
- ~L3506:
path.dirname(new URL(import.meta.url).pathname) (live detect path)
Fix
Replace new URL(import.meta.url).pathname with fileURLToPath(import.meta.url) from node:url, which correctly handles Windows drive letters:
import { fileURLToPath } from 'node:url';
const scriptPath = path.join(path.dirname(fileURLToPath(import.meta.url)), 'detect-antipatterns-browser.js');
Environment
- Windows 11 Pro
- Node.js (via npm global install)
- impeccable installed via
npm i -g impeccable
Bug
npx impeccable detect <url>fails on Windows with:Note the doubled
C:\C:\.Cause
In
src/detect-antipatterns.mjs, two locations construct the path todetect-antipatterns-browser.jsusing:On Windows,
new URL('file:///C:/foo/bar').pathnamereturns/C:/foo/bar(with a leading slash). When passed topath.joinorpath.resolve, Node prepends the drive letter again, producingC:\C:\....Affected lines:
path.dirname(new URL(import.meta.url).pathname)(puppeteer scan path)path.dirname(new URL(import.meta.url).pathname)(live detect path)Fix
Replace
new URL(import.meta.url).pathnamewithfileURLToPath(import.meta.url)fromnode:url, which correctly handles Windows drive letters:Environment
npm i -g impeccable