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

Error: No such module "node:os". #792

Open
hotrush opened this issue Dec 17, 2024 · 2 comments
Open

Error: No such module "node:os". #792

hotrush opened this issue Dec 17, 2024 · 2 comments

Comments

@hotrush
Copy link

hotrush commented Dec 17, 2024

I'm trying to test my worker with miniflare and so adding next code to my index.spec.ts

import { Miniflare } from 'miniflare';

const mf = new Miniflare({
	modules: true,
	scriptPath: './src/index.ts',
	r2Buckets: ['R2_BUCKET'],
});

When running it i'm getting an error:

Using vars defined in .dev.vars
[vpw:inf] Starting isolated runtimes for vitest.config.mts...
[mf:wrn] The latest compatibility date supported by the installed Cloudflare Workers Runtime is "2024-12-05",
but you've requested "2024-12-16". Falling back to "2024-12-05"...
workerd/server/server.c++:3052: error: Fallback service failed to fetch module; payload = ; spec = /?specifier=node%3Aos&referrer=%2FUsers%2Frush%2FProjects%2Fproj%2Fnode_modules%2Fminiflare%2Fdist%2Fsrc%2Findex.js%3Fmf_vitest_no_cjs_esm_shim&rawSpecifier=node%3Aos
 ❯ test/index.spec.ts (0)

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Suites 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

 FAIL  test/index.spec.ts [ test/index.spec.ts ]
Error: No such module "node:os".
 ❯ Users/rush/Projects/proj/node_modules/miniflare/dist/src/index.js?mf_vitest_no_cjs_esm_shim:2623:26

Node: v20.17.0
Miniflare: 3.20241205.0

@andyjessop
Copy link

@hotrush thanks very much for reporting this! Would you be able to provide us with a minimal reproduction? I can't reproduce this locally, and I'm wondering how this node:os dependency is creeping into the code.

@hotrush
Copy link
Author

hotrush commented Dec 17, 2024

@andyjessop here it is https://github.com/hotrush/cf-miniflare-eror, just run npm run test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Untriaged
Development

No branches or pull requests

2 participants