Search code examples
gruntjsgit-bashimage-compression

can't install grunt-contrib-imagemin using git bash


when i'm typing this line in the git bash

npm install grunt-contrib-imagemin --save-dev

i get this errors

npm WARN saveError ENOENT: no such file or directory, open'C:\Users\hussa\package.json' C:\Users\hussa

`-- grunt-contrib-imagemin@1.0.1

npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\hussa\package.json'

npm WARN hussa No description

npm WARN hussa No repository field.

npm WARN hussa No README data

npm WARN hussa No license field.


Solution

  • You are telling npm to update your package.json file with the new dependency when using the --save-dev flags

    Looks like you dont have a package.json file in your current directory. In which case you can create one with npm init and then rerun the npm install command after it is created.

    If you do have a package.json file check you have permissions to edit and ensure it is not corrupt.