"Cannot find any of modules: sass,node-sass" although `sass` installed
See original GitHub issueDescribe 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:
- Install
svelte-preprocess
andsass
- Configure svelte.config.js by setting the
sass.implementation
to `require(‘sass’) - Open any .svelte file
Expected behavior
- The extension doesn’t throw errors
Screenshots
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:
- Created 3 years ago
- Comments:8 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub 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.