iamblue / generator-angular-ui-router

I add "ui-router" in this module. Fork from https://github.com/yeoman/generator-angular
71 stars 28 forks source link

fix(app) grunt-contrib-imagemin error when generating app #21

Closed BGR360 closed 8 years ago

BGR360 commented 8 years ago

Hi all,

I've been poring over this error for a while now and have found a solution. I will be submitting a pull request with the change that I believe will fix it.

The Problem

With a fresh install of generator-angular-ui-router, when I run the app generator, I receive the following error during npm install stage:

yo angular-ui-router

... lots of good stuff ...

> gifsicle@0.1.7 postinstall /Users/Ben/Documents/CodingProjects/test/node_modules/gifsicle
> node index.js

path.js:7
    throw new TypeError('Path must be a string. Received ' + inspect(path));
    ^

TypeError: Path must be a string. Received { url: 'https://raw.github.com/imagemin/gifsicle-bin/v0.1.7/vendor/osx/gifsicle',
  name: 'gifsicle',
  os: 'darwin' }
    at assertPath (path.js:7:11)
    at Object.basename (path.js:1357:5)
    at /Users/Ben/Documents/CodingProjects/test/node_modules/download/index.js:35:43
    at each (/Users/Ben/Documents/CodingProjects/test/node_modules/each-async/each-async.js:63:4)
    at module.exports (/Users/Ben/Documents/CodingProjects/test/node_modules/download/index.js:33:5)
    at /Users/Ben/Documents/CodingProjects/test/node_modules/bin-wrapper/index.js:108:20
    at /Users/Ben/Documents/CodingProjects/test/node_modules/bin-wrapper/index.js:141:24
    at /Users/Ben/Documents/CodingProjects/test/node_modules/bin-check/index.js:30:20
    at /Users/Ben/Documents/CodingProjects/test/node_modules/executable/index.js:39:20
    at FSReqWrap.oncomplete (fs.js:123:15)

I have included the full console log (with the npm log) here.

System details

Mac OS X El Capitan Node version 6.4.0 npm version 3.10.3 Yeoman version 1.8.4 generator-angular-ui-router version 0.5.3

Reproducing

Install the above versions of the above things (they're all up to date as of today).

$ yo angular-ui-router
(node:51907) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
[?] Would you like to use Sass with the Compass CSS Authoring Framework? No
[?] Would you like to include Twitter Bootstrap? Yes
[?] Would you like to use the SCSS version of Twitter Bootstrap with the Compass CSS Authoring Framework? No
[?] Which modules would you like to include? angular-resource.js, angular-cookies.js, angular-sanitize.js, angular-ui-router.js

The Cause

This error is caused by gifsicle version 0.1.7, which is purportedly known to be annoying and cause issues.

The Solution

To solve the issue I had to manually edit the package.json of my newly generated angular-ui-router project and switch from grunt-contrib-imagemin version 0.2.0 to version 1.0.1.

My proposed solution is to edit the file templates/common/_package.json and change the dependency to "~1.0.1~. I will now begin writing code to fix the issue.