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

Created on 19 Oct 2020  路  4Comments  路  Source: sveltejs/language-tools

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.

question

Most helpful comment

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

All 4 comments

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

The extension referred to above is Svelte for VS Code.

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

And what extension to use instead of that?

Was this page helpful?
0 / 5 - 0 ratings