Can't import npm installed module into project

44 Views Asked by At

I've set up a svelte-electron project and imported https://github.com/LuanRT/YouTube.js using the command: npm i youtubei.js

It used to work but now suddenly when I install it, the project can't import it.

When I type import in typescript it doesn't autocomplete and when I type it out manually and run, it throws an error saying it can't find the module.

[svelte] Error: Not found: /node_modules/youtubei.js/src/Innertube.ts
[svelte]     at resolve (C:\Users\LAPTOP\my-skeleton-app\node_modules\@sveltejs\kit\src\runtime\server\respond.js:483:13)
[svelte]     at resolve (C:\Users\LAPTOP\my-skeleton-app\node_modules\@sveltejs\kit\src\runtime\server\respond.js:277:5)
[svelte]     at #options.hooks.handle (C:\Users\LAPTOP\my-skeleton-app\node_modules\@sveltejs\kit\src\runtime\server\index.js:49:56)
[svelte]     at Module.respond (C:\Users\LAPTOP\my-skeleton-app\node_modules\@sveltejs\kit\src\runtime\server\respond.js:274:40)
[svelte]     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[electron] [29832:1127/083336.022:ERROR:CONSOLE(1)] "Could not load content for http://localhost:5173/node_modules/youtubei.js/src/Innertube.ts (HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE)", source: devtools://devtools/bundled/core/sdk/sdk.js (1)

Error in electron browser

When I checked the node-modules file, the folder for youtubei.js is clearly right there, it just can't find it for some reason. When I try installing other modules, the same thing will happen.

Node version: v20.10.0

Npm version: 10.2.3

How I set up my electron: https://www.youtube.com/watch?v=XoOjzHDTNiU

0

There are 0 best solutions below