Search code examples
node.jsmacossassgruntjspatternlab.io

Task "sass" not found using grunt with PatternLab


Sass is not found when I'm using grunt with PatternLab.

I have Mac El Capitan, and I think Node and Sass are properly setup even though I am still not sure why it cannot find Sass.

I tried to install another version of Node and Sass, but still the same error.

Any ideas?

See below the grunt output:


Running "shell:patternlabStyles-rpm" (shell) task npm WARN deprecated [email protected]: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^3.0.0.

[email protected] postinstall /Users/my_user/Projects/my_app/src/global/pattern-lab find node_modules/ -name "*.info" -type f -delete

[email protected] node_modules/grunt-scss-lint └── [email protected] Using rainbow 2.0.0 Using sass 3.4.5 Using bundler 1.11.2 Using scss-lint 0.33.0 Bundle complete! 1 Gemfile dependency, 4 gems now installed. Use bundle show [gemname] to see where a bundled gem is installed. Loading "sass.js" tasks...ERROR >> Error: The libsass binding was not found in /Users/my_user/Projects/my_app/src/global/pattern-lab/node_modules/node-sass/vendor/darwin-x64-46/binding.node

This usually happens because your node version has changed. Run npm rebuild node-sass to build the binding for your current node version. Warning: Task "sass" not found. Use --force to continue.

Aborted due to warnings.


PS: Concerning the line: "Error: The libsass binding was not found in /Users/my_user/Projects/my_app/src/global/pattern-lab/node_modules/node-sass/vendor/darwin-x64-46/binding.node", the vendor folder doesn't exist.


Solution

  • I found the fix, it was necessary to add the correct node-sass binary where it was expected to be.

    The solution was put in practice in this post.

    So, manually created folder "darwin-x64-14". Then downloaded equivalent "binding.node" file from https://github.com/sass/node-sass-binaries/blob/master/darwin-x64-14_binding.node and copied the file to "darwin-x64-14" folder.