peggy icon indicating copy to clipboard operation
peggy copied to clipboard

The -c --extra-options-file flag isn't working

Open damianpeaf opened this issue 1 year ago • 7 comments

I was using the command with version 4.0.3, and it worked correctly.

npx peggy -c .\config.js

But now that I try to use it with version 4.1.1, I get the following error message:

Error importing config ".\config.js" Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'

I'm not sure if this issue is directly related to Peggy or something in Node.

Node version: 22.5.1
OS: Windows 11

damianpeaf avatar Oct 16 '24 04:10 damianpeaf

Try renaming it to .mjs to see if that works?

hildjj avatar Oct 16 '24 04:10 hildjj

Also try ./ instead of .\, to help diagnose.

hildjj avatar Oct 16 '24 04:10 hildjj

I'm still getting the same message

npx peggy -c .\config.mjs

Error importing config ".\config.mjs"
Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
npx peggy -c ./config.mjs

Error importing config "./config.mjs"
Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
npx peggy -c ./config.js 

Error importing config "./config.js"
Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'

damianpeaf avatar Oct 16 '24 04:10 damianpeaf

Nod. I'll look into this tomorrow.

hildjj avatar Oct 16 '24 04:10 hildjj

Can you turn on "--verbose" command line flag, and post the results here? Be sure to mask out any personal information!

hildjj avatar Oct 16 '24 05:10 hildjj

Sorry for taking so long to respond, I was a bit busy.

This is the output I receive:

npx --verbose peggy -c .\config.js
npm verbose cli C:\Program Files\nodejs\node.exe C:\Users\user\AppData\Roaming\nvm\v22.5.1\node_modules\npm\bin\npm-cli.js
npm info using [email protected]
npm info using [email protected]
npm verbose title npm exec peggy -c .\config.js
npm verbose argv "exec" "--loglevel" "verbose" "--" "peggy" "-c" ".\\config.js"
npm verbose logfile logs-max:10 dir:C:\Users\user\AppData\Local\npm-cache\_logs\2024-10-17T07_32_07_041Z-
npm verbose logfile C:\Users\user\AppData\Local\npm-cache\_logs\2024-10-17T07_32_07_041Z-debug-0.log
npm http fetch GET 200 https://registry.npmjs.org/peggy 392ms (cache revalidated)
Error importing config ".\config.js"
Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
npm verbose cwd C:\Users\user\OneDrive\Documents\class12
npm verbose os Windows_NT 10.0.22631
npm verbose node v22.5.1
npm verbose npm  v10.8.2
npm verbose exit 1
npm verbose code 1
npx peggy --verbose -c .\config.js 
Error importing config ".\config.js"
Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'

damianpeaf avatar Oct 17 '24 01:10 damianpeaf

@damianpeaf can you please try https://github.com/peggyjs/peggy/pull/569 to see if it works for you?

hildjj avatar Oct 17 '24 21:10 hildjj

I had the same issue and #569 seems to be working well for me. Could we get this fix merged sometimes in the near future ?

gzp79 avatar Nov 19 '24 08:11 gzp79

@gzp79 thanks for testing. I'll get this merged and released in the next day or so.

hildjj avatar Nov 19 '24 09:11 hildjj

In release v4.2.0

hildjj avatar Nov 19 '24 18:11 hildjj