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

Bug: could not run npx siimple -c -o without changing a file in node_modules #192

Closed
pepijnmm opened this issue Oct 10, 2022 · 2 comments · Fixed by #193
Closed

Bug: could not run npx siimple -c -o without changing a file in node_modules #192

pepijnmm opened this issue Oct 10, 2022 · 2 comments · Fixed by #193
Assignees
Labels
bug Okay, Houston...we've had a problem here CLI Issues related with the CLI

Comments

@pepijnmm
Copy link

Describe the issue

when I tried to run the setup commands following https://siimple.xyz/getting-started/
I got the following error on "npx siimple -c ./siimple.config.mjs -o ./output.css"
see screenshot.

To reproduce

for me, it just happened after doing the second step.
my npm is 8.19.2
node v16.13.0

Screenshots

image

What browser(s) are you seeing the problem on?

No response

What version of siimple are you using?

4.3.0(according to package/package-lock)

Additional context

I could "fix" it by reading a bit on https://stackoverflow.com/a/70057245/4769837
where I read Imports can only do file:// and data://.
So I changed where the error came from on siimple/cli/index.js from:

    return import(configPath).then(rawConfig => rawConfig.default);

to:

    return import("file://" + configPath).then(rawConfig => rawConfig.default);

which fixed it but of course not a great solution.

@pepijnmm pepijnmm added the under-investigation Issues that are currently under investigation label Oct 10, 2022
@jmjuanes jmjuanes self-assigned this Oct 11, 2022
@jmjuanes
Copy link
Owner

Hello @pepijnmm.

Instead of concatenating "file://" to the configuration path we can use url.pathToFileURL:

return import(url.pathToFileURL(configPath)).then(rawConfig => rawConfig.default);

As I see in the documentation is the recommended way when using absolute paths with import https://nodejs.org/api/esm.html#file-urls.

@jmjuanes jmjuanes added bug Okay, Houston...we've had a problem here CLI Issues related with the CLI and removed under-investigation Issues that are currently under investigation labels Oct 11, 2022
@jmjuanes
Copy link
Owner

jmjuanes commented Oct 12, 2022

Hello @pepijnmm I have just published v4.3.1 with the patch for your issue. Now it should work as expected, but if the issue persists please feel free to reopen the issue.

Thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Okay, Houston...we've had a problem here CLI Issues related with the CLI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants