New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add npm dependencies to engine descriptions #65
Conversation
If you don't specify an engine, The initial error you received sounds like you copy/pasted the entirety of the config including The reason this error was appearing is dependencies are checked when npm install grunt-spritesmith # npm will use the version already listed in `package.json` If this error was happening without you specifying |
Here is the entirety of the initial grunt-spritesmith config. //grunt config
sprite:{
all: {
src: ['<%= yeoman.app %>/../../app/assets/images/icons/*.png'],
destImg: '<%= yeoman.app %>/images/icons.png',
destCSS: '<%= yeoman.app %>/styles/icons.scss',
cssFormat: 'scss'
}
},
That is the case, no engine is specified above. |
Well that is no fun. Can you tell me what version of
|
|
Cool, thanks. I will take a look by the end of the weekend. |
Alright, I matched up your environment package for package and could not reproduce. https://gist.github.com/twolfson/8838601 The 'could not be loaded' text only appears when you specify an engine. I am leaving this issue as closed. https://github.com/Ensighten/spritesmith/blob/0.17.4/src/smith.js#L33 |
:+1 thanks for looking into... > var assert = require('assert');
undefined
> assert.equal('auto', 'auto', 'this does nothing')
undefined
> assert.notEqual('auto', 'auto', 'this does what you intend, but reading the code does not make sense')
AssertionError: this does nothing
at repl:1:9
at REPLServer.self.eval (repl.js:110:21)
at Interface.<anonymous> (repl.js:239:12)
at Interface.EventEmitter.emit (events.js:95:17)
at Interface._onLine (readline.js:202:10)
at Interface._line (readline.js:531:8)
at Interface._ttyWrite (readline.js:760:14)
at ReadStream.onkeypress (readline.js:99:10)
at ReadStream.EventEmitter.emit (events.js:98:17)
at emitKey (readline.js:1095:12)
> assert.notEqual('meow', 'auto', 'this does nothing')
undefined In the line you referenced
When replaced with assert.notEqual(enginePref, 'auto', 'Sorry, the spritesmith engine \'' + enginePref + '\' could not be loaded. Please be sure you have installed it properly on your machine.'); I get the intended effect of the message being displayed on the screen. However, the code doesn't read well that way.
Edit: See next comment |
I'm an idiot. Your code for checking that assertion is fine. I still get ENOENT. Even with out specifying the engine. It turns out It looks like spritesmith is including $ grep -A4 dependencies grunt-spritesmith/node_modules/spritesmith/package.json
"dependencies": {
"async": "~0.2.6",
"layout": "~1.3.0",
"phantomjssmith": "~0.4.0",
"gmsmith": "~0.3.0",
--
//... This totally differs from your package.json on spritesmith. https://github.com/Ensighten/spritesmith/blob/0.17.4/package.json#L19 I reinstalled grunt-spritesmith and reinstalled and verified it is installing gmsmith. $ npm install grunt-spritesmith
npm WARN package.json rally@0.0.0 No description
npm WARN package.json rally@0.0.0 No repository field.
npm WARN package.json rally@0.0.0 No README data
npm http GET https://registry.npmjs.org/grunt-spritesmith
npm http 304 https://registry.npmjs.org/grunt-spritesmith
npm http GET https://registry.npmjs.org/spritesmith
npm http GET https://registry.npmjs.org/json2css
npm http GET https://registry.npmjs.org/underscore
npm http GET https://registry.npmjs.org/url2
npm http 304 https://registry.npmjs.org/underscore
npm http 304 https://registry.npmjs.org/url2
npm http 304 https://registry.npmjs.org/json2css
npm http 304 https://registry.npmjs.org/spritesmith
npm http GET https://registry.npmjs.org/mustache
npm http GET https://registry.npmjs.org/json-content-demux
npm http GET https://registry.npmjs.org/async
npm http GET https://registry.npmjs.org/layout
npm http GET https://registry.npmjs.org/gmsmith
npm http GET https://registry.npmjs.org/canvassmith
npm http GET https://registry.npmjs.org/pngsmith
npm http 304 https://registry.npmjs.org/async
npm http 304 https://registry.npmjs.org/json-content-demux
npm http 304 https://registry.npmjs.org/layout
npm http 304 https://registry.npmjs.org/canvassmith
npm http 304 https://registry.npmjs.org/pngsmith
npm http 304 https://registry.npmjs.org/gmsmith
npm http 304 https://registry.npmjs.org/mustache
npm http GET https://registry.npmjs.org/obj-extend
npm http GET https://registry.npmjs.org/temporary/0.0.5
npm http GET https://registry.npmjs.org/canvas
npm http GET https://registry.npmjs.org/binpacking/0.0.1
> gmsmith@0.3.0 preinstall /Users/hulahoop/workspace/rally/ng/node_modules/grunt-spritesmith/node_modules/spritesmith/node_modules/gmsmith
> gm -version || convert -version
sh: gm: command not found
Version: ImageMagick 6.8.7-0 2013-11-22 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC
Features: DPC
npm http GET https://registry.npmjs.org/ndarray
npm http GET https://registry.npmjs.org/get-pixels
npm http GET https://registry.npmjs.org/save-pixels
npm http GET https://registry.npmjs.org/concat-stream
npm http GET https://registry.npmjs.org/gm
npm http 304 https://registry.npmjs.org/obj-extend
npm http 304 https://registry.npmjs.org/canvas
npm http 304 https://registry.npmjs.org/ndarray Checking on the npm registry itself shows this
It looks like all of this has nothing to do with you. I'm sorry for pestering you, it turns out something is crazy with npm. |
Discussion moved to npm/npm-registry-couchapp#146 |
https://npmjs.org/doc/json.html#dependencies For spritesmith, we use https://github.com/Ensighten/grunt-spritesmith#requirements Additionally, it leads to the error messages you are seeing during installation. These are non-fatal error messages and are noted in FAQs. https://github.com/Ensighten/grunt-spritesmith#i-am-seeing-errors-during-installation It seems that there is an assumptive flaw in |
The regression has been patched in |
After installing grunt-spritesmith
npm install grunt-spritesmith --save-dev
and setting it up to load some icons originally from a rails project
after running
grunt sprite --stack
I get thisI found where we are calling spawn
The spawn is trying to launch "convert" or "identify", but those binaries exist. Assuming there is some irreparable bug, I moved on to a few other less mature sprite frameworks with less success.
I gave grunt-spritesmith another shot, this time searching for the node.js call for spawn, which apparently is compiled. I fired up
dtrace
to see the underlying syscalls. Here is the output when getting thespawn ENOENT
Apparently there is some bug loading the "gm" spritesmith engine. I don't have graphicsmagic installed on the system anywhere, and couldn't find it with brew.
After reading the spritesmith docs it seemed that phantomjs would be the better choice. The docs say I just need to make sure phantomjs is installed.
Digging through the source, I found some troubling code.
I did
npm install phantomjssmith --save-dev
then rangrunt sprite
and everything worked!It seems that the main README.md does not mention these packages have to be installed to use the engines.
I'm going to err on the side that there is something obvious that I missed so that I had to go down this rabbit hole. In case I didn't miss anything, here is a PR to clear this up a bit.