Add support for remote URL's
mihhail-lapushkin opened this issue · 8 comments
From #9.
Done.
After latest changes I've got error on npm install:
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:101:14)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:64:11
gyp ERR! stack at Object.oncomplete (fs.js:107:15)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "node" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd D:\Projects\Web01\node_modules\grunt-css-url-embed\node_modules\mmmagic
gyp ERR! node -v v0.10.26
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm http 304 https://registry.npmjs.org/core-util-is
npm http 304 https://registry.npmjs.org/string_decoder
npm http 304 https://registry.npmjs.org/isarray/0.0.1
npm http 304 https://registry.npmjs.org/inherits
npm ERR! mmmagic@0.3.8 install:node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mmmagic@0.3.8 install script.
npm ERR! This is most likely a problem with the mmmagic package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls mmmagic
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install"
npm ERR! cwd D:\Projects\Web01
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! D:\Projects\Web01\npm-debug.log
npm ERR! not ok code 0
Envirnment: Windows 8.1
Could you help to address this?
node-gyp that builds the MIME type sniffer needs Python 2.7 to run.
I will add it to README.
Did it require Python at all before?
No, it did not. I added MIME type sniffing through a native plugin that is built from C when you install the module. The reason for this is that in case of remote URL's you can have something like http://website.com/generate.php?width=400&height=200
. Previously, the plugin was just checking the extension of the file, which it this case would be 'php', but the actual content in the response will be some type of image.
And in general it is also better to check the content, not the extension, since you can also have similar problems with files on your file system.
Well, I understand your point. But on other hand, we have to install python to all our servers just because of this plugin, which makes it very unuseful.
Is there any way to avoid installation 3rd party components?
You can always use the previous version of the plugin. The only feature that was added is remote URL support. If you want this functionality, then you have to install python.
Lots of other plugins use node-gyp, for example imagemin, so it is something that is quite common in nodejs world. I don't see any point in making my plugin worse for other people just because one person has troubles to fulfil the usage requirements.
Just to be clear- I totally understand your frustration, but unless I get a lot of complains about python, I will not remove MIME type sniffing.
Yes, I understand.
Thank you for explanation and great plugin you did!