rubynode.jsmacosgruntjsgrunt-contrib-sass

When I install a grunt package grunt does not automatically install


I am very new to Grunt and node so please bear with me. I am on a mac OSX operating system. I will walk you through the scripts I ran in detail to help. In my terminal. First I installed Homebrew using:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

And then I installed node using homebrew:

brew install node

Ran the grunt command line interface

npm install -g grunt-cli

Ran Sass

sudo gem install sass

Initiated node to update/create my package.json file:

npm init


{
  "name": "sass-test",
  "version": "1.0.0",
  "description": "Simple Test Project",
  "main": "Gruntfile.js"
  "author": "Jerry Thomas"
  "license": "ISC"
} 

Now here is the strange part

When I ran:

npm install grunt-contrib-sass --save-dev

I got a UNMET PEER DEPENDENCY grunt@>=0.4.0 error

And when I looked into my package.json file. The grunt-contrib-sass pack was installed but grunt wasn't installed.

 {
    "name": "sass-test",
    "version": "1.0.0",
    "description": "A test to mke sure that Grunt and Sass work",
    "main": "index.html",
    "author": "Jimmy Thomas",
    "devDependencies": {
    "grunt-contrib-sass": "^1.0.0"
 }
}

Isn't npm smart enough to know if you want grunt-contrib-sass you also need grunt, so it installs both of them?

Shouldn't my package.joson file be automatically updated to: "devDependencies": { "grunt": "^0.4.5", "grunt-contrib-sass": "^1.0.0" }

Am I missing something?

Thanks


Solution

  • The short answer is NO. You have to do npm install grunt --save-dev and also for your plugins. Check the documentation http://gruntjs.com/getting-started. Pro tip you can do install all your grunt package all together like npm install grunt grunt-contrib-sass --save-dev