I'm working with Mac OS X 10.7.5 and I'm using Grunt to concate some js files and minify them. Now I want to also minify my css files. As grunt does not provide any functionality I wanted to install a grunt plugin for that. According to the instructions i have to cd into my projects root folder and install the plugin with npm. So I did the following:
cd <PROJECT_ROOT>
npm install grunt-contrib-css
The instructions for the plugin are here: https://npmjs.org/package/grunt-contrib-mincss The I opened my 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 any problem and npm ls does list the module.
Any ideas what I have done wrong? Many Thanks!
UPDATED
When I cd into a project like so
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 hard copy the files into my projects root directory (which works) but it's kind of strange isn't it?
UPDATE 2 I've updated node and tried it again. Below is the console output.
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
[email protected] ../../node_modules/grunt-contrib-mincss
├── [email protected]
├── [email protected] ([email protected], [email protected])
└── [email protected] ([email protected])
Why is the plugin installed outside? Or is there a way to define the actual location where it is installed?
I had a similar issue on Ubuntu 12.04 for the module grunt-jasmine-task
(same error message as above). This solved the issue for me:
node_modules
in the root of the project.npm install grunt-jasmine-task
again.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With