I work with Mac OS X 10.7.5, and I use Grunt to concretize some js files and minimize them. Now I want to also reduce my css files. Since grunt does not provide any functionality, I wanted to install the grunt plugin for it. According to the instructions, I have to connect to the root folder of my projects and install the plugin with npm number. So I did the following:
cd <PROJECT_ROOT> npm install grunt-contrib-css
Instructions for the plugin are given here: https://npmjs.org/package/grunt-contrib-mincss I opened the grunt.js file and added
grunt.loadNpmTasks('grunt-contrib-mincss');
But when I try to run grunt, I just get
Local Npm module "grunt-contrib-mincss" not found. Is it installed? <WARN> Task "mincss" not found. Use --force to continue. </WARN>
The installation works without problems, and npm ls lists the module.
Any ideas what I did wrong? Thank you very much!
UPDATED
When I joined a similar project
cd ~/Sites/path/to/project
and then install the plugin
sudo npm install grunt-contrib-mincss
the module is actually installed in
~/node_modules/grunt-contrib-mincss
I could copy the files to the root directory of my projects (which works), but this is strange, right?
UPDATE 2 I updated node and tried again. The console output is shown below.
me:~ Fritz$ node -v v0.8.10 me:~ Fritz$ npm -v 1.1.62 me:~ Fritz$ mkdir ./Sites/npm-test me:~ Fritz$ cd ./Sites/npm-test/ me:npm-test Fritz$ sudo npm install grunt-contrib-mincss Password: npm http GET https://registry.npmjs.org/grunt-contrib-mincss npm http 304 https://registry.npmjs.org/grunt-contrib-mincss npm http GET https://registry.npmjs.org/gzip-js npm http GET https://registry.npmjs.org/clean-css npm http GET https://registry.npmjs.org/grunt-contrib-lib npm http 304 https://registry.npmjs.org/gzip-js npm http 304 https://registry.npmjs.org/clean-css npm http 304 https://registry.npmjs.org/grunt-contrib-lib npm http GET https://registry.npmjs.org/crc32 npm http GET https://registry.npmjs.org/deflate-js npm http GET https://registry.npmjs.org/optimist npm http 304 https://registry.npmjs.org/deflate-js npm http 304 https://registry.npmjs.org/crc32 npm http 304 https://registry.npmjs.org/optimist npm http GET https://registry.npmjs.org/wordwrap npm http 304 https://registry.npmjs.org/wordwrap grunt-contrib-mincss@0.3.0 ../../node_modules/grunt-contrib-mincss ├── grunt-contrib-lib@0.3.0 ├── gzip-js@0.3.1 ( crc32@0.2.2 , deflate-js@0.2.2 ) └── clean-css@0.4.2 ( optimist@0.3.4 )
Why is the plugin installed externally? Or is there a way to determine the actual place where it is installed?