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

Invalid module - code ERR_INVALID_MODULE_SPECIFIER #74

Closed
frandiox opened this issue Dec 26, 2021 · 7 comments
Closed

Invalid module - code ERR_INVALID_MODULE_SPECIFIER #74

frandiox opened this issue Dec 26, 2021 · 7 comments

Comments

@frandiox
Copy link
Owner

This error is thrown when using Node >= 16.2 due to this breaking change: nodejs/node#37468

Downgrade to 16.11 or 14 for now. This breaking change might be backported to 14 as well.

@alexturpin
Copy link

alexturpin commented Dec 26, 2021

Thanks for notifying here! I was on a quest to figure this out when it occurred to me to come see here. Unfortunately, I seem to be getting the same problem on Node v14.18.2... I had just upgraded to 16 to see if it would fix it.

alext@Alex-Office MINGW64 ~/src/project (main)
$ npm run dev

> project@0.0.0 dev
> vitedge dev --ssr

(node:11816) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
TypeError [ERR_INVALID_MODULE_SPECIFIER]: Invalid module "file:///C:/Users/alext/src/project/node_modules/.bin/vite-ssr" 
    at new NodeError (internal/errors.js:322:7)
    at Loader.getFormat (internal/modules/esm/loader.js:118:13)
    at Loader.getModuleJob (internal/modules/esm/loader.js:243:20)
    at Loader.import (internal/modules/esm/loader.js:177:17)
    at Object.loadESM (internal/process/esm_loader.js:68:5)

alext@Alex-Office MINGW64 ~/src/project (main)
$ node --version
v14.18.2

And this is the day I pick to integrate Vitedge to my project 😅

@alexturpin
Copy link

Same error on v14.17.6, a different one for v14.16.1 and v.15.15.5.

TypeError [ERR_INVALID_RETURN_PROPERTY_VALUE]: Expected string to be returned for the "format" from the "loader getFormat" function but got type object.
    at Loader.getFormat (internal/modules/esm/loader.js:111:13)
    at Loader.getModuleJob (internal/modules/esm/loader.js:231:20)
    at Loader.import (internal/modules/esm/loader.js:165:17)
    at Object.loadESM (internal/process/esm_loader.js:68:5)

@frandiox
Copy link
Owner Author

@alexturpin I'm not seeing the issue with latest 14 🤔
Is your project using TS or JS?

@alexturpin
Copy link

@frandiox TypeScript. I also tried ts-node 10, 9 and 8 to no avail.

@frandiox
Copy link
Owner Author

@alexturpin 0.17.4 should have these issues fixed. Can you please give it a try?

@alexturpin
Copy link

@frandiox yes, thank you very much for the quick fix!

@mwoodruff
Copy link

I'm getting this error with reactesse-edge-template, regardless of node version. npm / yarn also makes no difference. Manual steps from the getting started page results in same. Running on windows.

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