Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
kytta opened this issue Oct 19, 2020 · 8 comments
Closed

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

kytta opened this issue Oct 19, 2020 · 8 comments
Labels
question Further information is requested

Comments

@kytta
Copy link

kytta commented Oct 19, 2020

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.

@kytta kytta added the bug Something isn't working label Oct 19, 2020
@kytta
Copy link
Author

kytta commented 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

@kytta kytta closed this as completed Oct 19, 2020
@dummdidumm dummdidumm added question Further information is requested and removed bug Something isn't working labels Oct 20, 2020
@iamdimitar
Copy link

The extension referred to above is Svelte for VS Code.

@xreider
Copy link

xreider commented Mar 16, 2021

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?

@dummdidumm
Copy link
Member

This one

@timohausmann
Copy link

Those links are identical.

old extension: https://marketplace.visualstudio.com/items?itemName=JamesBirtles.svelte-vscode
new extention: https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode

Even with the new extension, after installing sass, I still got this error. Error disappeared after restarting VSCode.

@StasJDM
Copy link

StasJDM commented Jan 23, 2022

I fixed it by installing sass and node-sass dependencies

@matthewwyndham
Copy link

I needed to reload my vscode extension for svelte

@Soren-365
Copy link

got this error after using node 18.1.0 on another project, returning to 17.5.0 and installing node-sass solved the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

8 participants