Can't compile Sass with Grunt












0















I'm new to Grunt. Following this tutorial.



I'm having a heck of a time trying to get Grunt to compile Sass. I keep getting the following when I run grunt sass:




Loading "sass.js" tasks...ERROR
>> SyntaxError: Unexpected token (
Warning: Task "sass" not found. Use --force to continue.

Aborted due to warnings.




  • node: v6.11.0,

  • npm: v6.4.1,

  • grunt cli: v1.3.2


package.json:



{
"name": "yb",
"version": "1.0.0",
"description": "yb site build",
"main": "src/js/main.js",
"dependencies": {},
"devDependencies": {
"grunt": "^1.0.3",
"grunt-contrib-concat": "^1.0.1",
"grunt-sass": "^3.0.2",
"node-sass": "^4.10.0"
},
"scripts": {
"test": "echo "Error: no test specified" && exit 1"
},
"author": "Scott",
"license": "ISC"
}


Gruntfile.js



module.exports = function(grunt) {

// Configuration
grunt.initConfig({
concat: {
js: {
src: ['src/**/*.js'],
dest: 'assets/js/main.js'
},
css: {
src: ['src/**/*.css'],
dest: 'assets/css/main.css'
}
},

sass: {
build: {
files: [{
src: 'src/sass/test.scss',
dest: 'assets/css/test.css'
}]
}
}

});

// Load Plugins
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-sass');

// Register Tasks
grunt.registerTask('concat-js', ['concat:js']);
grunt.registerTask('concat-css', ['concat:css']);
};


The grunt-sass docs give a different configuration (which I've also tried), but I still can't get it to compile.



As far as I know, everything is installed. I can't find where I'm going off the rails here. Any thoughts?



Thanks!










share|improve this question





























    0















    I'm new to Grunt. Following this tutorial.



    I'm having a heck of a time trying to get Grunt to compile Sass. I keep getting the following when I run grunt sass:




    Loading "sass.js" tasks...ERROR
    >> SyntaxError: Unexpected token (
    Warning: Task "sass" not found. Use --force to continue.

    Aborted due to warnings.




    • node: v6.11.0,

    • npm: v6.4.1,

    • grunt cli: v1.3.2


    package.json:



    {
    "name": "yb",
    "version": "1.0.0",
    "description": "yb site build",
    "main": "src/js/main.js",
    "dependencies": {},
    "devDependencies": {
    "grunt": "^1.0.3",
    "grunt-contrib-concat": "^1.0.1",
    "grunt-sass": "^3.0.2",
    "node-sass": "^4.10.0"
    },
    "scripts": {
    "test": "echo "Error: no test specified" && exit 1"
    },
    "author": "Scott",
    "license": "ISC"
    }


    Gruntfile.js



    module.exports = function(grunt) {

    // Configuration
    grunt.initConfig({
    concat: {
    js: {
    src: ['src/**/*.js'],
    dest: 'assets/js/main.js'
    },
    css: {
    src: ['src/**/*.css'],
    dest: 'assets/css/main.css'
    }
    },

    sass: {
    build: {
    files: [{
    src: 'src/sass/test.scss',
    dest: 'assets/css/test.css'
    }]
    }
    }

    });

    // Load Plugins
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-sass');

    // Register Tasks
    grunt.registerTask('concat-js', ['concat:js']);
    grunt.registerTask('concat-css', ['concat:css']);
    };


    The grunt-sass docs give a different configuration (which I've also tried), but I still can't get it to compile.



    As far as I know, everything is installed. I can't find where I'm going off the rails here. Any thoughts?



    Thanks!










    share|improve this question



























      0












      0








      0








      I'm new to Grunt. Following this tutorial.



      I'm having a heck of a time trying to get Grunt to compile Sass. I keep getting the following when I run grunt sass:




      Loading "sass.js" tasks...ERROR
      >> SyntaxError: Unexpected token (
      Warning: Task "sass" not found. Use --force to continue.

      Aborted due to warnings.




      • node: v6.11.0,

      • npm: v6.4.1,

      • grunt cli: v1.3.2


      package.json:



      {
      "name": "yb",
      "version": "1.0.0",
      "description": "yb site build",
      "main": "src/js/main.js",
      "dependencies": {},
      "devDependencies": {
      "grunt": "^1.0.3",
      "grunt-contrib-concat": "^1.0.1",
      "grunt-sass": "^3.0.2",
      "node-sass": "^4.10.0"
      },
      "scripts": {
      "test": "echo "Error: no test specified" && exit 1"
      },
      "author": "Scott",
      "license": "ISC"
      }


      Gruntfile.js



      module.exports = function(grunt) {

      // Configuration
      grunt.initConfig({
      concat: {
      js: {
      src: ['src/**/*.js'],
      dest: 'assets/js/main.js'
      },
      css: {
      src: ['src/**/*.css'],
      dest: 'assets/css/main.css'
      }
      },

      sass: {
      build: {
      files: [{
      src: 'src/sass/test.scss',
      dest: 'assets/css/test.css'
      }]
      }
      }

      });

      // Load Plugins
      grunt.loadNpmTasks('grunt-contrib-concat');
      grunt.loadNpmTasks('grunt-sass');

      // Register Tasks
      grunt.registerTask('concat-js', ['concat:js']);
      grunt.registerTask('concat-css', ['concat:css']);
      };


      The grunt-sass docs give a different configuration (which I've also tried), but I still can't get it to compile.



      As far as I know, everything is installed. I can't find where I'm going off the rails here. Any thoughts?



      Thanks!










      share|improve this question
















      I'm new to Grunt. Following this tutorial.



      I'm having a heck of a time trying to get Grunt to compile Sass. I keep getting the following when I run grunt sass:




      Loading "sass.js" tasks...ERROR
      >> SyntaxError: Unexpected token (
      Warning: Task "sass" not found. Use --force to continue.

      Aborted due to warnings.




      • node: v6.11.0,

      • npm: v6.4.1,

      • grunt cli: v1.3.2


      package.json:



      {
      "name": "yb",
      "version": "1.0.0",
      "description": "yb site build",
      "main": "src/js/main.js",
      "dependencies": {},
      "devDependencies": {
      "grunt": "^1.0.3",
      "grunt-contrib-concat": "^1.0.1",
      "grunt-sass": "^3.0.2",
      "node-sass": "^4.10.0"
      },
      "scripts": {
      "test": "echo "Error: no test specified" && exit 1"
      },
      "author": "Scott",
      "license": "ISC"
      }


      Gruntfile.js



      module.exports = function(grunt) {

      // Configuration
      grunt.initConfig({
      concat: {
      js: {
      src: ['src/**/*.js'],
      dest: 'assets/js/main.js'
      },
      css: {
      src: ['src/**/*.css'],
      dest: 'assets/css/main.css'
      }
      },

      sass: {
      build: {
      files: [{
      src: 'src/sass/test.scss',
      dest: 'assets/css/test.css'
      }]
      }
      }

      });

      // Load Plugins
      grunt.loadNpmTasks('grunt-contrib-concat');
      grunt.loadNpmTasks('grunt-sass');

      // Register Tasks
      grunt.registerTask('concat-js', ['concat:js']);
      grunt.registerTask('concat-css', ['concat:css']);
      };


      The grunt-sass docs give a different configuration (which I've also tried), but I still can't get it to compile.



      As far as I know, everything is installed. I can't find where I'm going off the rails here. Any thoughts?



      Thanks!







      sass gruntjs node-sass






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 25 '18 at 12:00









      RobC

      5,91492238




      5,91492238










      asked Nov 24 '18 at 2:32









      ScottScott

      7761018




      7761018
























          1 Answer
          1






          active

          oldest

          votes


















          0















          1. check ruby with ruby -v (install [ruby][1] )

          2. Install Sass with sudo gem install sass (install [sass][2] )


          setting for Grunt Tasks & run grunt convert-sass



          // Load Grunt
          module.exports = function (grunt) {
          grunt.initConfig({
          pkg: grunt.file.readJSON('package.json'),

          // Tasks
          concat: {
          js: {
          src: ['src/**/*.js'],
          dest: 'assets/js/main.js'
          },
          css: {
          src: ['src/**/*.css'],
          dest: 'assets/css/main.css'
          }
          },

          sass: {
          dist: {
          options: {
          sourcemap: 'none'
          },
          files: [{
          expand: true,
          cwd: 'src/sass',
          src: ['**/*.scss'],
          dest: 'assets/css',
          ext: '.css'
          }]
          }
          }

          });

          // Load plugins
          grunt.loadNpmTasks('grunt-contrib-sass');
          grunt.loadNpmTasks('grunt-sass');
          grunt.loadNpmTasks('grunt-contrib-concat');

          // Register Tasks
          grunt.registerTask('concat-js', ['concat:js']);
          grunt.registerTask('concat-css', ['concat:css']);
          grunt.registerTask('convert-sass', 'sass');

          };





          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53454700%2fcant-compile-sass-with-grunt%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0















            1. check ruby with ruby -v (install [ruby][1] )

            2. Install Sass with sudo gem install sass (install [sass][2] )


            setting for Grunt Tasks & run grunt convert-sass



            // Load Grunt
            module.exports = function (grunt) {
            grunt.initConfig({
            pkg: grunt.file.readJSON('package.json'),

            // Tasks
            concat: {
            js: {
            src: ['src/**/*.js'],
            dest: 'assets/js/main.js'
            },
            css: {
            src: ['src/**/*.css'],
            dest: 'assets/css/main.css'
            }
            },

            sass: {
            dist: {
            options: {
            sourcemap: 'none'
            },
            files: [{
            expand: true,
            cwd: 'src/sass',
            src: ['**/*.scss'],
            dest: 'assets/css',
            ext: '.css'
            }]
            }
            }

            });

            // Load plugins
            grunt.loadNpmTasks('grunt-contrib-sass');
            grunt.loadNpmTasks('grunt-sass');
            grunt.loadNpmTasks('grunt-contrib-concat');

            // Register Tasks
            grunt.registerTask('concat-js', ['concat:js']);
            grunt.registerTask('concat-css', ['concat:css']);
            grunt.registerTask('convert-sass', 'sass');

            };





            share|improve this answer




























              0















              1. check ruby with ruby -v (install [ruby][1] )

              2. Install Sass with sudo gem install sass (install [sass][2] )


              setting for Grunt Tasks & run grunt convert-sass



              // Load Grunt
              module.exports = function (grunt) {
              grunt.initConfig({
              pkg: grunt.file.readJSON('package.json'),

              // Tasks
              concat: {
              js: {
              src: ['src/**/*.js'],
              dest: 'assets/js/main.js'
              },
              css: {
              src: ['src/**/*.css'],
              dest: 'assets/css/main.css'
              }
              },

              sass: {
              dist: {
              options: {
              sourcemap: 'none'
              },
              files: [{
              expand: true,
              cwd: 'src/sass',
              src: ['**/*.scss'],
              dest: 'assets/css',
              ext: '.css'
              }]
              }
              }

              });

              // Load plugins
              grunt.loadNpmTasks('grunt-contrib-sass');
              grunt.loadNpmTasks('grunt-sass');
              grunt.loadNpmTasks('grunt-contrib-concat');

              // Register Tasks
              grunt.registerTask('concat-js', ['concat:js']);
              grunt.registerTask('concat-css', ['concat:css']);
              grunt.registerTask('convert-sass', 'sass');

              };





              share|improve this answer


























                0












                0








                0








                1. check ruby with ruby -v (install [ruby][1] )

                2. Install Sass with sudo gem install sass (install [sass][2] )


                setting for Grunt Tasks & run grunt convert-sass



                // Load Grunt
                module.exports = function (grunt) {
                grunt.initConfig({
                pkg: grunt.file.readJSON('package.json'),

                // Tasks
                concat: {
                js: {
                src: ['src/**/*.js'],
                dest: 'assets/js/main.js'
                },
                css: {
                src: ['src/**/*.css'],
                dest: 'assets/css/main.css'
                }
                },

                sass: {
                dist: {
                options: {
                sourcemap: 'none'
                },
                files: [{
                expand: true,
                cwd: 'src/sass',
                src: ['**/*.scss'],
                dest: 'assets/css',
                ext: '.css'
                }]
                }
                }

                });

                // Load plugins
                grunt.loadNpmTasks('grunt-contrib-sass');
                grunt.loadNpmTasks('grunt-sass');
                grunt.loadNpmTasks('grunt-contrib-concat');

                // Register Tasks
                grunt.registerTask('concat-js', ['concat:js']);
                grunt.registerTask('concat-css', ['concat:css']);
                grunt.registerTask('convert-sass', 'sass');

                };





                share|improve this answer














                1. check ruby with ruby -v (install [ruby][1] )

                2. Install Sass with sudo gem install sass (install [sass][2] )


                setting for Grunt Tasks & run grunt convert-sass



                // Load Grunt
                module.exports = function (grunt) {
                grunt.initConfig({
                pkg: grunt.file.readJSON('package.json'),

                // Tasks
                concat: {
                js: {
                src: ['src/**/*.js'],
                dest: 'assets/js/main.js'
                },
                css: {
                src: ['src/**/*.css'],
                dest: 'assets/css/main.css'
                }
                },

                sass: {
                dist: {
                options: {
                sourcemap: 'none'
                },
                files: [{
                expand: true,
                cwd: 'src/sass',
                src: ['**/*.scss'],
                dest: 'assets/css',
                ext: '.css'
                }]
                }
                }

                });

                // Load plugins
                grunt.loadNpmTasks('grunt-contrib-sass');
                grunt.loadNpmTasks('grunt-sass');
                grunt.loadNpmTasks('grunt-contrib-concat');

                // Register Tasks
                grunt.registerTask('concat-js', ['concat:js']);
                grunt.registerTask('concat-css', ['concat:css']);
                grunt.registerTask('convert-sass', 'sass');

                };






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 26 '18 at 4:53









                Shiv Kumar BaghelShiv Kumar Baghel

                1,3643820




                1,3643820






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53454700%2fcant-compile-sass-with-grunt%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Berounka

                    Fiat S.p.A.

                    Type 'String' is not a subtype of type 'int' of 'index'