sass-loader: Error: `sass-loader` requires `node-sass` >=4 but node-sass is already at v4
ran encore dev --watch
get this error :
Module build failed: ModuleBuildError: Module build failed: Error: `sass-loader` requires `node-sass` >=4. Please install a compatible version.
at Object.sassLoader (/var/www/VulcanoCMS/node_modules/sass-loader/lib/loader.js:31:19)
at runLoaders (/var/www/VulcanoCMS/node_modules/webpack/lib/NormalModule.js:195:19)
at /var/www/VulcanoCMS/node_modules/loader-runner/lib/LoaderRunner.js:364:11
at /var/www/VulcanoCMS/node_modules/loader-runner/lib/LoaderRunner.js:230:18
at runSyncOrAsync (/var/www/VulcanoCMS/node_modules/loader-runner/lib/LoaderRunner.js:143:3)
at iterateNormalLoaders (/var/www/VulcanoCMS/node_modules/loader-runner/lib/LoaderRunner.js:229:2)
at /var/www/VulcanoCMS/node_modules/loader-runner/lib/LoaderRunner.js:202:4
at /var/www/VulcanoCMS/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:70:14
at process._tickCallback (internal/process/next_tick.js:112:11)
but node-sass is at v4.8.3 in package.json :
{
"devDependencies": {
"@symfony/webpack-encore": "^0.20.1",
"node-sass": "^4.8.3",
"sass-loader": "^7.0.1"
},
"license": "UNLICENSED",
"private": true,
"scripts": {
"dev-server": "encore dev-server",
"dev": "encore dev",
"watch": "encore dev --watch",
"build": "encore production"
},
"dependencies": {
"bootstrap": "^4.1.0",
"jquery": "^3.3.1"
}
}
already tried deleting node-modules folder and package-lock.json
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 2
- Comments: 34 (8 by maintainers)
Commits related to this issue
- Always install npm dependencies during build Some node dependencies, such as `node-sass`, are platform-specific - mounting `node_modules` leads to the Docker build using missing the correct platform ... — committed to ubclaunchpad/inertia by bobheadxi 6 years ago
- fix: Errors being swallowed when trying to load node-sass Fixes #563 — committed to webpack-contrib/sass-loader by jhnns 6 years ago
- fix: Errors being swallowed when trying to load node-sass (#576) Fixes #563 — committed to webpack-contrib/sass-loader by jhnns 6 years ago
I’ve also got the same error when upgrading node from v6.12 to v8.11.1 (now npm v5.6.0):
Module build failed: Error: `sass-loader` requires `node-sass` >=4. Please install a compatible version.
This worked for me:
npm rebuild node-sass
I had the exact same problem. It was because of a cached version of node-sass.
This solution worked for me:
node-sass
from globalnpm-cache
(For Windows users%userprofile%\AppData\Roaming\npm-cache
)node-sass
from your project’snode_modules
dirnpm install
to reinstall node-sass@SundownDEV
rm -rf node_modules && npm/yarn cache clear --force && npm/yarn install
npm rebuild node-sass
is solution, don’t post spam pleasenpm rebuild node-sass
worked for me too.I think that the principal issue here is that
sass-loader 7.x
displays a wrong error message:when
node-sass 4.x
is installed but unusable (e.g. when it is compiled for another environment)Whereas
sass-loader 6.x
displays a clearer and more accurate error message:(see https://github.com/webpack-contrib/sass-loader/issues/563#issuecomment-390435456 for full output)
Reopening the issue until it gets fixed.
Quick fix solutions (just choose one of these) :
rm -rf node_modules && npm/yarn cache clear --force && npm/yarn install
npm rebuild node-sass
yarn remove node-sass
andyarn add node-sass
npm install
npm install
to reinstall it (reference:https://github.com/webpack-contrib/sass-loader/issues/563#issuecomment-384751280)@evilebottnawi please add proper labels
npm rebuild node-sass
fixed it for me. Thanks!The soluctions… All time is fails!
Delete
orclean cache
the proyect is “new”, is starts!! no exist denode_modules
rebuild
exist many problems in when run root. And"postinstall" : "npm rebuild"
. Well, thats is not a solution!The versions
I’m having this same issue…which I was able to fix locally, but is there a workaround for this issue from a build server?
after downgrading to
sass-loader@6.0.7
, I had a clearer error:Seems like my issue was to run
npm install
first on my Mac before building the Docker image based on Debian then bindingnode_volumes
from the Mac to the Debian container using avolume
for information, to solve this, I edit my docker-compose.yaml file from
to
this makes the containerized app using its own
node_modules
directory instead of using the one from the host machineI got this consistently even after clearing out node_modules and yarn’s cache. Upgraded from node 6.13.1 to 8.11.1, did
yarn remove node-sass and
andyarn add node-sass
and everything worked again.