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.

"Cannot find any of modules: sass,node-sass" although `sass` installed

See original GitHub issue

Describe the bug On every single .svelte file the extension throws this error at me (copied from Output tab):

Using Svelte v3.29.0 from /Users/nick/PROJECT_ROOT_REDACTED/node_modules/svelte/compiler
Preprocessing failed
Error: Cannot find any of modules: sass,node-sass

Error: Cannot find module 'node-sass'
Require stack:
- /Users/nick/.vscode/extensions/svelte.svelte-vscode-102.2.0/node_modules/svelte-preprocess/dist/modules/utils.js
- /Users/nick/.vscode/extensions/svelte.svelte-vscode-102.2.0/node_modules/svelte-preprocess/dist/autoProcess.js
- /Users/nick/.vscode/extensions/svelte.svelte-vscode-102.2.0/node_modules/svelte-preprocess/dist/index.js
- /Users/nick/.vscode/extensions/svelte.svelte-vscode-102.2.0/node_modules/svelte-language-server/dist/src/importPackage.js
- /Users/nick/.vscode/extensions/svelte.svelte-vscode-102.2.0/node_modules/svelte-language-server/dist/src/lib/documents/configLoader.js
- /Users/nick/.vscode/extensions/svelte.svelte-vscode-102.2.0/node_modules/svelte-language-server/dist/src/lib/documents/Document.js
- /Users/nick/.vscode/extensions/svelte.svelte-vscode-102.2.0/node_modules/svelte-language-server/dist/src/lib/documents/index.js
- /Users/nick/.vscode/extensions/svelte.svelte-vscode-102.2.0/node_modules/svelte-language-server/dist/src/server.js
- /Users/nick/.vscode/extensions/svelte.svelte-vscode-102.2.0/node_modules/svelte-language-server/bin/server.js
    at Object.importAny (/Users/nick/.vscode/extensions/svelte.svelte-vscode-102.2.0/node_modules/svelte-preprocess/dist/modules/utils.js:30:15)
    at async transformer (/Users/nick/.vscode/extensions/svelte.svelte-vscode-102.2.0/node_modules/svelte-preprocess/dist/transformers/scss.js:18:21)
    at async /Users/nick/.vscode/extensions/svelte.svelte-vscode-102.2.0/node_modules/svelte-preprocess/dist/autoProcess.js:96:29
    at async Object.style (/Users/nick/.vscode/extensions/svelte.svelte-vscode-102.2.0/node_modules/svelte-preprocess/dist/autoProcess.js:142:33)
    at async wrappedPreprocessor.style (/Users/nick/.vscode/extensions/svelte.svelte-vscode-102.2.0/node_modules/svelte-language-server/dist/src/plugins/svelte/SvelteDocument.js:208:33)
    at async /Users/nick/PROJECT_ROOT_REDACTED/node_modules/svelte/compiler.js:27431:32
    at async Promise.all (index 0)
    at async replace_async (/Users/nick/PROJECT_ROOT_REDACTED/node_modules/svelte/compiler.js:27386:52)
    at async Object.preprocess (/Users/nick/PROJECT_ROOT_REDACTED/node_modules/svelte/compiler.js:27427:19)
    at async transpile (/Users/nick/.vscode/extensions/svelte.svelte-vscode-102.2.0/node_modules/svelte-language-server/dist/src/plugins/svelte/SvelteDocument.js:223:25) {
  __source: 'Style'
}

I have svelte-preprocess installed and its settings are in svelte.config.js which looks like this:

// svelte.config.js
const sveltePreprocess = require('svelte-preprocess');

module.exports = {
  preprocess: sveltePreprocess({
    postcss: {
      plugins: [
        require('autoprefixer')
      ]
    },
    sass: {
      sync: true,
      implementation: require('sass'),
    },
  }),
};

I have tried removing implementation and it didn’t work. It also doesn’t work when setting sass: true. I didn’t try using node-sass since I need the Dart implementation specifically.

The error appears even in places without scss code (see screenshot)

To Reproduce Steps to reproduce the behavior:

  1. Install svelte-preprocess and sass
  2. Configure svelte.config.js by setting the sass.implementation to `require(‘sass’)
  3. Open any .svelte file

Expected behavior

  1. The extension doesn’t throw errors

Screenshots grafik

System (please complete the following information):

  • OS: macOS Catalina 10.15.7
  • IDE: VSCode 1.50.1
  • Plugin/Package: “Svelte for VSCode”

Additional context I am developing a Sapper app, not just Svelte.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
kyttacommented, Oct 19, 2020

Alright, I feel very dumb 😅

Although I checked before, I missed the old extension by James Birtles which was still installed. Upon removing the old extension and reloading VSCode, the message was gone

4reactions
iamdimitarcommented, Nov 7, 2020

The extension referred to above is Svelte for VS Code.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ERROR in Cannot find module 'node-sass' - Stack Overflow
Whenever you did npm install to the initial installation, the sass module did not get installed, which is why this problem occurs. Share....
Read more >
Cannot find module 'node-sass' on NPM build
I tried running a build 'ng build --prod' locally and didnt encounter any errors. I also tried add a new build step calling....
Read more >
Cannot Find Module Sass: 8 Solutions That You Can Use in ...
1. Update Your Dockerfile and “package. · 2. Clear Npm Cache and Install Sass · 3. Move Sass to “Dependencies” in “package. ·...
Read more >
How to add SCSS or SASS to SvelteKit - Hao's learning log
Although Svelte/SvelteKit support other CSS preprocessors, ... Cannot find any of modules: sass,node-sass Error: Cannot find module ...
Read more >
Cannot find module 'node-sass' while running the angular 7 ...
This is happening because of your node_modules does not contain the material directory. To add Material into your node_modules run below command npm...
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