Search code examples
javascriptjsonnode.jsgruntjsgrunt-contrib-watch

Grunt isn't loading


Please bear with me because I am new to node and grunt.

When I run Grunt using:

Wine-MacBook-JT:sass-test jthomas$ grunt

I get the following error:

Loading "Gruntfile.js" tasks...ERROR

Error: Unable to parse "package.json" file (Unexpected token } in JSON at position 248). Warning: Task "default" not found. Use --force to continue.

Not sure what the issue is. My JSON Code is:

{
  "name": "sass-test",
  "version": "1.0.0",
  "description": "Simple test project for Grunt and Sass",
  "main": "Gruntfile.js",
  "devDependencies": {
    "grunt": "^0.4.5",
    "grunt-contrib-sass": "^1.0.0",
    "[email protected]"
  }
}

My Directory structure is set up as

||sass-test
   ||.sass-cache
   ||.node-modules
   SCSS
     ||_main.scss
     ||_mixins.scss
     ||_style.scss

Gruntfile.js
package.json

Solution

  • The "[email protected]" line in your package.json is not valid json.

    I would delete that line, and just use npm install --save-dev grunt-contrib-watch to re-add it to the package.json. Otherwise, just modify it by hand to something like:

    "grunt-contrib-watch": "^1.0.0"
    

    And make sure you npm install again, if you modify the package.json by hand, since there's a good chance that package is not actually installed.

    Here's the full fixed package.json blob:

    {
      "name": "sass-test",
      "version": "1.0.0",
      "description": "Simple test project for Grunt and Sass",
      "main": "Gruntfile.js",
      "devDependencies": {
        "grunt": "^0.4.5",
        "grunt-contrib-sass": "^1.0.0",
        "grunt-contrib-watch": "^1.0.0"
      }
    }