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

Preprocessor argument doesn't work with Windows paths #490

Closed
ooker777 opened this issue Jul 10, 2024 · 0 comments · Fixed by #491
Closed

Preprocessor argument doesn't work with Windows paths #490

ooker777 opened this issue Jul 10, 2024 · 0 comments · Fixed by #491

Comments

@ooker777
Copy link
Contributor

ooker777 commented Jul 10, 2024

I create test.md with content foobar, and test.js with content:

export default function (markdown, _options) {
  return new Promise((resolve, _reject) => {
    return resolve(markdown);
  });
}

Running reveal-md --preprocessor .\test.js .\test.md gives me this error:

Serving reveal.js from C:\Users\ganuo\AppData\Roaming\npm\node_modules\reveal-md\node_modules\reveal.js
Reveal-server started at http://localhost:1948
The slides are at http://localhost:1948/test.md
node:internal/modules/esm/resolve:772
    throw new ERR_INVALID_MODULE_SPECIFIER(
          ^

TypeError [ERR_INVALID_MODULE_SPECIFIER]: Invalid module ".\test.js" is not a valid package name imported from C:\Users\ganuo\AppData\Roaming\npm\node_modules\reveal-md\lib\config.js
    at parsePackageName (node:internal/modules/esm/resolve:772:11)
    at packageResolve (node:internal/modules/esm/resolve:796:5)
    at moduleResolve (node:internal/modules/esm/resolve:918:18)
    at defaultResolve (node:internal/modules/esm/resolve:1148:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:390:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:359:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:234:38)
    at ModuleLoader.import (node:internal/modules/esm/loader:322:34)
    at importModuleDynamically (node:internal/modules/esm/translators:160:35)
    at importModuleDynamicallyCallback (node:internal/modules/esm/utils:225:14) {
  code: 'ERR_INVALID_MODULE_SPECIFIER'
}

It's because of the way Node handle Windows path. See nodejs/node#31710

@ooker777 ooker777 changed the title ERR_INVALID_MODULE_SPECIFIER Preprocessor argument doesn't work with Windows paths Jul 10, 2024
ooker777 added a commit to ooker777/reveal-md that referenced this issue Jul 10, 2024
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

Successfully merging a pull request may close this issue.

1 participant