twolfson / grunt-spritesmith

Grunt task for converting a set of images into a spritesheet and corresponding CSS variables
MIT License
1.14k stars 92 forks source link

engine 'phantomjssmith' leads to error on WIN 7 #139

Closed ssuvorov closed 9 years ago

ssuvorov commented 9 years ago

On mac everything is fine. On Win7 we use *.png images, engine: 'phantomjssmith', timeout: 30000 and have an issue

Images not loaded within 30 seconds. Timing out script.

Removing timeout option leads to

TypeError: undefined is not a constructor (evaluating 'window.processCommand(params)')
twolfson commented 9 years ago

As a sanity check, can you clone the phantomjssmith repo and run its tests?

# Clone our repo
git clone https://github.com/twolfson/phantomjssmith
cd phantomjssmith/

# Install our dependencies and dev dependencies
npm install

# Run our tests
npm test
ssuvorov commented 9 years ago

Sorry, guys, for such long delay. I have no my own windows workstation. So it was tested by colleague. Here is the result:

$ npm install
npm WARN package.json phantomjssmith@0.6.0 No license field.
npm WARN engine pngjs@0.4.0: wanted: {"node":"0.8.x"} (current: {"node":"0.12.5","npm":"2.11.2"})
npm WARN prefer global grunt@0.3.17 should be installed with -g

$ npm test

> phantomjssmith@0.6.0 test d:\localhost\smith\phantomjssmith
> mocha --timeout 60000

child_process: customFds option is deprecated, use stdio instead.

  phantomjssmith
    interpretting an image file
      1) "before all" hook: interpretImagesFn

  0 passing (3s)
  1 failing

  1) phantomjssmith interpretting an image file "before all" hook: interpretImagesFn:
     Uncaught SyntaxError: Unexpected token T
      at Object.parse (native)
      at saveImgSize (d:\localhost\smith\phantomjssmith\lib\image.js:27:31)
      at fn (d:\localhost\smith\phantomjssmith\node_modules\async\lib\async.js:582:34)
      at Immediate._onImmediate (d:\localhost\smith\phantomjssmith\node_modules\async\lib\async.js:498:34)
      at processImmediate [as _immediateCallback] (timers.js:367:17)

npm ERR! Test failed.  See above for more details.
twolfson commented 9 years ago

What version of phantomjs do you have installed?

phantomjs --version
ssuvorov commented 9 years ago

2.0.0

twolfson commented 9 years ago

phantomjssmith was developed against 1.9.x. Can you try running the tests with phantomjs@1.9.x?

ssuvorov commented 9 years ago

version 1.9.8

$ npm test

> phantomjssmith@0.6.0 test d:\localhost\smith\phantomjssmith
> mocha --timeout 60000

child_process: customFds option is deprecated, use stdio instead.

  phantomjssmith
    interpretting an image file
      √ gathers statistics on an image file
    parsing multiple images
      rendering them into a canvas
        √ can output an image (282ms)
    interpretting a ridiculous amount of images
      rendering them into a canvas
        √ does not crash
        √ returns an image
    interpretting a large image
      √ gathers proper image size

  phantomjssmith
    exporting a jpeg
      √ returns an image
      - returns an accurate image
    running against very long URLs
      √ does not crash
      √ returns an image
    with a custom timeout
      √ times out very easily

  9 passing (14s)
  1 pending
ssuvorov commented 9 years ago

Guess, the issue is fixed, cuz depending on phantomjs version. In addition our grunt sprites task is also work fine! Thanks.

twolfson commented 9 years ago

Woo hoo, glad to hear we found the cause of the issue =)