Skip to content
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

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

Closed
damianpeaf opened this issue Oct 16, 2024 · 10 comments
Closed

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

damianpeaf opened this issue Oct 16, 2024 · 10 comments

Comments

@damianpeaf
Copy link

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

@hildjj
Copy link
Contributor

hildjj commented Oct 16, 2024

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

@hildjj
Copy link
Contributor

hildjj commented Oct 16, 2024

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

@damianpeaf
Copy link
Author

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:'

@hildjj
Copy link
Contributor

hildjj commented Oct 16, 2024

Nod. I'll look into this tomorrow.

@hildjj
Copy link
Contributor

hildjj commented Oct 16, 2024

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

@damianpeaf
Copy link
Author

damianpeaf commented Oct 17, 2024

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 npm@10.8.2
npm info using node@v22.5.1
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:'

@hildjj
Copy link
Contributor

hildjj commented Oct 17, 2024

@damianpeaf can you please try #569 to see if it works for you?

@gzp79
Copy link

gzp79 commented Nov 19, 2024

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 ?

@hildjj
Copy link
Contributor

hildjj commented Nov 19, 2024

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

@hildjj hildjj closed this as completed in 5385d24 Nov 19, 2024
hildjj added a commit that referenced this issue Nov 19, 2024
Fixes #567.  Use file: URLs to import ES6.
@hildjj
Copy link
Contributor

hildjj commented Nov 19, 2024

In release v4.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants