sveltejs / language-tools

The Svelte Language Server, and official extensions which use it
MIT License
1.24k stars 198 forks source link

Error in svelte.config.js Error [ERR_MODULE_NOT_FOUND]: Cannot find package ... @ampproject/remapping #2315

Closed keyvez closed 7 months ago

keyvez commented 7 months ago

Describe the bug

I am seeing an error in the problems view that says:

Error in svelte.config.js

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '/Users/gaurav/Documents/Code/tow/admin/prompt_reviewer/node_modules/@ampproject/remapping/' imported from /Users/gaurav/Documents/Code/tow/admin/prompt_reviewer/node_modules/svelte/src/compiler/utils/mapped_code.js

whenever I have a .svelte file open in the editor.

I had never installed any other svelte extensions before or used svelte, so shouldn't have those association to html or extension by James Birtles installed.

I also tried removing node_modules and reinstalling them with npm i and bun i.

Reproduction

I just created a fresh project and installed a component from shadcn-svelte and when I install the svelte VSCode extension, I see this error.

Expected behaviour

There shouldn't be any problems with a fresh project creation.

System Info

Which package is the issue about?

No response

Additional Information, eg. Screenshots

utils.js was called utils.js.js, I renamed it to utils.js and updated the imports to just say import { cn } from "$lib/utils";, I have also tried import { cn } from "$lib/utils.js"; but it didn't work.

keyvez commented 7 months ago

Removing node_modules and just doing bun i and closing and reopening VSCode fixed it.