question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Cannot find module 'svelte/compiler' (v 4.2.0)

See original GitHub issue

After update the plugin I got an error “Error: Cannot find module ‘svelte/compiler’” I installed the plugin as a global and as a local lib Svelte installed only as a local lib

prettier src/Form.svelte              
src/Form.svelte[error] src/Form.svelte: Error: Cannot find module 'svelte/compiler'
[error]     at Function.Module._resolveFilename (module.js:547:15)
[error]     at Function.Module._load (module.js:474:25)
[error]     at Module.require (module.js:596:17)
[error]     at require (internal/module.js:11:18)
[error]     at Object.parse (/home/jungle/.nvm/versions/node/v8.11.1/lib/node_modules/prettier-plugin-svelte/plugin.js:479:20)
[error]     at Object.parse$2 [as parse] (/home/jungle/.nvm/versions/node/v8.11.1/lib/node_modules/prettier/bin-prettier.js:10635:19)
[error]     at coreFormat (/home/jungle/.nvm/versions/node/v8.11.1/lib/node_modules/prettier/bin-prettier.js:13844:23)
[error]     at format (/home/jungle/.nvm/versions/node/v8.11.1/lib/node_modules/prettier/bin-prettier.js:14103:73)
[error]     at formatWithCursor (/home/jungle/.nvm/versions/node/v8.11.1/lib/node_modules/prettier/bin-prettier.js:14119:12)
[error]     at Object.formatWithCursor (/home/jungle/.nvm/versions/node/v8.11.1/lib/node_modules/prettier/bin-prettier.js:42520:15)

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
pyonercommented, May 6, 2019

But it works when svelte installed as a global lib

0reactions
henriquehbrcommented, Jul 19, 2020

I was having the exact same problem, the solution for me was installing svelte as a dependency instead of a peerDependency, after that, prettier cli was working flawlessly

Read more comments on GitHub >

github_iconTop Results From Across the Web

UnhandledPromiseRejectionWar...
UnhandledPromiseRejectionWarning : Error: Cannot find module 'svelte/compiler' · Module svelte is installed both locally and globally. · Module ...
Read more >
r/sveltejs - Reddit
Cannot find module './App.​​ I'm using JavaScript (not TS) and also have the Svelte VS Code extension installed. Although everything is working ...
Read more >
Changelog - Cypress Documentation
Fixes #24611; Fixed an 11.0.0 regression where using custom reporters would cause Cypress to throw a 'Cannot find module' error.
Read more >
vue cannot find module or type declarations - You.com
VueJS/Typescript error: Cannot find module 'my-module' or its ... "vue-pdf": "^4.2.0", "vue": "^3.0.0", chorme version 87.0.4280.88 iPhone OS 1323 image.
Read more >
rollup-plugin-svelte | Yarn - Package Manager
Compile Svelte components. Installation. npm install --save-dev svelte rollup-plugin-svelte. Note that we need to install Svelte as well as ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found