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: Cannot find module TorrentState.js #1

Open
ZVanoZ opened this issue Nov 7, 2024 · 0 comments
Open

Error: Cannot find module TorrentState.js #1

ZVanoZ opened this issue Nov 7, 2024 · 0 comments

Comments

@ZVanoZ
Copy link

ZVanoZ commented Nov 7, 2024

OS: Linux ivan-debian12 6.1.0-26-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.112-1 (2024-09-30) x86_64 GNU/Linux

$ npm run dev

> [email protected] dev
> npx tsx watch src/index.ts


node:internal/modules/run_main:122
    triggerUncaughtException(
    ^
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/ivan/zim/work/00_examples.tmp/TypeScript/ts-torrent/src/TorrentState.js' imported from /home/ivan/zim/work/00_examples.tmp/TypeScript/ts-torrent/src/index.ts
    at finalizeResolution (node:internal/modules/esm/resolve:257:11)
    at moduleResolve (node:internal/modules/esm/resolve:913:10)
    at defaultResolve (node:internal/modules/esm/resolve:1037:11)
    at nextResolve (node:internal/modules/esm/hooks:748:28)
    at resolveBase (file:///home/ivan/zim/work/00_examples.tmp/TypeScript/ts-torrent/node_modules/tsx/dist/esm/index.mjs?1730957885415:2:3093)
    at async resolveDirectory (file:///home/ivan/zim/work/00_examples.tmp/TypeScript/ts-torrent/node_modules/tsx/dist/esm/index.mjs?1730957885415:2:3339)
    at async resolve (file:///home/ivan/zim/work/00_examples.tmp/TypeScript/ts-torrent/node_modules/tsx/dist/esm/index.mjs?1730957885415:2:4202)
    at async nextResolve (node:internal/modules/esm/hooks:748:22)
    at async Hooks.resolve (node:internal/modules/esm/hooks:240:24)
    at async handleMessage (node:internal/modules/esm/worker:199:18) {
  code: 'ERR_MODULE_NOT_FOUND',
  url: 'file:///home/ivan/zim/work/00_examples.tmp/TypeScript/ts-torrent/src/TorrentState.js'
}

Node.js v22.11.0

Reason

Linux has case-sentivity file system.
Imported file has invalid name.

actual:  import { Bitfield } from "#src/Bitfield.js";
correct: import { Bitfield } from "#src/bitfield.js";

I think the beast way is rename files to CamelCase. Because files contents classes.

bitfield.ts     >> Bitfield.ts
torrentState.ts >> TorrentState.ts
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

1 participant