npm fails and breaks into infinite loop on npm pngquant-bin install #4014

Closed
SgtPooki opened this Issue Oct 20, 2013 · 23 comments

Comments

Projects
None yet

This issue has also been reported by other users, see sindresorhus/node-pngquant-bin#3. For me, it started and occurs with any yo generator I use. After yo starts the

bower install & npm install

portion... it then goes on installing dependencies working fine.. until

> pngquant-bin@0.1.5 postinstall /home/sgtpooki/Programming/yeomanWebAppTest2/node_modules/grunt-contrib-imagemin/node_modules/pngquant-bin
> node lib/check.js

[31m✗ pre-build test failed, compiling from source... 
[31m✗ Command failed: In file included from pngquant.c:56:0:
rwpng.h:35:57: fatal error: png.h: No such file or directory
compilation terminated.
make: *** [pngquant.o] Error 1

and it repeats endlessly.

After checking the logs I was able to determine the issue was with npm and pngquant-bin and confirmed it by typing

npm install pngquant-bin

It then goes into an infinite loop again... see the log from the npm specific command here: http://pastebin.com/GLPrSR4e

SgtPooki referenced this issue in imagemin/pngquant-bin Oct 20, 2013

Closed

Installation error on linux #3

switching back to npm v 1.2.10 prevented the infinite loop issue.

pngquant-bin still fails, but npm actually stops after a few tries and responds appropriately with

"failed at post install script, this is most likely a problem with the package."

So yes, sure, there's a problem with pngquant-bin, (and gifsicle) but there is also a problem with npm (except for 1.2.10) where it fails to recognize package errors.

SgtPooki referenced this issue in yeoman/generator-webapp_DEPRECATED Oct 20, 2013

Closed

Error running grunt with new webapp and default options #140

So how can i install pngquant and gifsicle then? Downgrading to 1.2.10 does not help. It looks like bin-wrapper is also broken, because if binary is localy avalible and on PATH it still wants to compile its own.

Contributor

luk- commented Oct 24, 2013

It looks like there's an issue with that postinstall script looping, not specifically with npm. Is there a deterministic way I can reproduce this myself?

I'm using:

node 0.10.12
npm 1.2.32
bin-wrapper 0.1.6

With every package using bin-wapper i get the same results. I would rather use system binaries, but looks like there's a bug in bin-wrapper that does not allow me this.

@luk- There is a problem with both the packages and npm.. because "switching back to npm v 1.2.10 prevented the infinite loop issue." which means 1.2.10 could gracefully handle the errors, but the new npm cannot.

does that make sense?

Contributor

luk- commented Oct 24, 2013

Reverting to an older version of npm and having an external piece of software act differently doesn't mean npm has a bug, this is a very shallow way of assessing the problem. If you can provide a deterministic test case, we can look into this further.

I see your point. However, ignoring the fact that software cannot handle errors gracefully, when running other external software or not, is not conducive to a software's success.

When I get back to working with node, I will be sure to log the steps used to consistently reproduce the error. Thanks for your responses.

lunias commented Oct 28, 2013

to reproduce just run: npm install pngquant-bin

It's looping for me as well.

Contributor

luk- commented Oct 28, 2013

@lunias I can't duplicate it on os x.

lunias commented Oct 28, 2013

Hmmm... I'm using arch.
$ uname -a
Linux eanderson-arch 3.11.6-1-ARCH #1 SMP PREEMPT Sat Oct 19 00:29:46 CEST 2013 i686 GNU/Linux

I'm new to node and npm. Is there a way for me to debug further?

How can I figure out which packages in my package.json depend on pngquant?
And how should I progress from there? There's lot of magic going on w/ 'npm install' that I don't understand yet.

grunt-contrib-imagemin is the most important package which uses pngquant,
because default yeoman template uses it. The problem is in bin-wrapper, but
from there on i don't have an idea.

On Mon, Oct 28, 2013 at 7:42 PM, Ethan Anderson notifications@github.comwrote:

Hmmm... I'm using arch.
$ uname -a
Linux eanderson-arch 3.11.6-1-ARCH #1https://github.com/isaacs/npm/issues/1SMP PREEMPT Sat Oct 19 00:29:46 CEST 2013 i686 GNU/Linux

I'm new to node and npm. Is there a way for me to debug further?

How can I figure out which packages in my package.json depend on pngquant?
And how should I progress from there? There's lot of magic going on w/
'npm install' that I don't understand yet.


Reply to this email directly or view it on GitHubhttps://github.com/isaacs/npm/issues/4014#issuecomment-27241934
.

lunias commented Oct 29, 2013

@offlinehacker sounds right to me.
I am using the yeoman angular generator.

Contributor

luk- commented Oct 29, 2013

It looks like the pngquant-bin module attempts to run make in a postinstall script. Can the author switch that to using node-gyp instead? This should help quite a bit.

Not sure if you have figured it out, but I came across the same sort of stuff when installing grunt-contrib-imagemin via yeoman on a new virtual server for testing. It is behind a proxy, so I had everything set up with git and npm to play nice behind the corporate firewall, but I still got this.

Then thought of something... the postinstall scripts do not inherit the $HTTP_PROXY environment variables since they are being run in an outside shell script of sorts. I added lines to export the proxy config to the plain vanilla ~/.profiles and it works like a charm.

Try this... maybe this will help as well.

Correction... it was also that I set the proxy in my ~/.bashrc... not sure which did it, but it seems to want to have an accessible environment variable...

jnav commented Nov 8, 2013

Not sure if i help you with this, but i have similar issue (npm install pngquant-bin -g)

root 347 0.0 0.1 88460 892 ? Ss 19:42 0:01 _ sshd: root@pts/1
root 351 0.0 0.0 14040 416 pts/1 Ss 19:42 0:00 _ -bash
root 1884 10.9 13.6 1006648 69168 pts/1 Sl+ 20:22 0:07 _ npm
root 1892 1.0 3.6 669636 18404 pts/1 Sl+ 20:22 0:00 _ node lib/check.js
root 1894 0.9 3.6 669640 18284 pts/1 Sl+ 20:22 0:00 _ node /usr/bin/pngquant --help
root 1896 1.0 3.6 669640 18276 pts/1 Sl+ 20:22 0:00 _ node /usr/bin/pngquant --help
root 1898 0.9 3.6 669640 18276 pts/1 Sl+ 20:22 0:00 _ node /usr/bin/pngquant --help
root 1900 1.0 3.6 669640 18280 pts/1 Sl+ 20:22 0:00 _ node /usr/bin/pngquant --help
root 1902 1.0 3.6 669640 18280 pts/1 Sl+ 20:22 0:00 _ node /usr/bin/pngquant --help
root 1904 1.0 3.6 669640 18280 pts/1 Sl+ 20:22 0:00 _ node /usr/bin/pngquant --help
root 1906 1.0 3.6 669640 18280 pts/1 Sl+ 20:22 0:00 _ node /usr/bin/pngquant --help
root 1908 1.0 3.6 669640 18276 pts/1 Sl+ 20:22 0:00 _ node /usr/bin/pngquant --help
root 1910 1.0 3.6 669640 18280 pts/1 Sl+ 20:22 0:00 _ node /usr/bin/pngquant --help
root 1912 1.1 3.6 669640 18280 pts/1 Sl+ 20:22 0:00 _ node /usr/bin/pngquant --help
root 1914 1.1 3.6 669640 18280 pts/1 Sl+ 20:22 0:00 _ node /usr/bin/pngquant --help
root 1916 1.0 3.6 669640 18276 pts/1 Sl+ 20:22 0:00 _ node /usr/bin/pngquant --help
root 1918 1.1 3.6 669640 18280 pts/1 Sl+ 20:22 0:00 _ node /usr/bin/pngquant --help
root 1920 1.1 3.6 669640 18280 pts/1 Sl+ 20:22 0:00 _ node /usr/bin/pngquant --help
root 1922 1.1 3.6 669640 18276 pts/1 Sl+ 20:22 0:00 _ node /usr/bin/pngquant --help
root 1924 1.1 3.6 669640 18280 pts/1 Sl+ 20:22 0:00 _ node /usr/bin/pngquant --help
root 1926 1.6 3.6 669640 18280 pts/1 Sl+ 20:22 0:00 _ node /usr/bin/pngquant --help
root 1928 1.3 3.6 669640 18280 pts/1 Sl+ 20:22 0:00 _ node /usr/bin/pngquant --help
root 1930 2.0 3.6 669640 18276 pts/1 Sl+ 20:22 0:00 _ node /usr/bin/pngquant --help
root 1932 16.9 1.3 665120 6960 pts/1 Dl+ 20:22 0:05 _ node /usr/bin/pngquant --help

then i ran the command manually to see the output:

[root@webio polymer]$ node /usr/bin/pngquant --help
FATAL ERROR: v8::Context::New() V8 is no longer usable

[root@webio ~]# node --version
v0.10.21

[root@webio ~]# uname -a
Linux webio 3.11.6-1-ARCH #1 SMP PREEMPT Fri Oct 18 23:22:36 CEST 2013 x86_64 GNU/Linux

dcolens commented Nov 20, 2013

for gifsicle have a look at yeoman/node-gifsicle#11

Contributor

luk- commented Nov 20, 2013

The issue is happening when a postinstall script attempts to compile a binary. Please don't do this, it will cause you grief. Use node-gyp instead.

luk- closed this Nov 20, 2013

kvervo referenced this issue in imagemin/gifsicle-bin Nov 23, 2013

Closed

Installing failed on CentOS #11

The problem still goes on. Why this issue was closed?

murphyj commented Oct 3, 2014

I don't get an infinite loop but I do get the following message:-

⚠ pre-build test failed, compiling from source...
⚠ pre-build test failed, compiling from source...
✗ pre-build test failed, compiling from source...
✗ Command failed: In file included from pngquant.c:56:
rwpng.h:35:57: error: png.h: No such file or directory
In file included from pngquant.c:56:
rwpng.h:59: error: expected specifier-qualifier-list before ‘png_uint_32’
rwpng.h:69: error: expected specifier-qualifier-list before ‘png_uint_32’
pngquant.c: In function ‘pngquant_output_image_free’:
pngquant.c:497: error: ‘png8_image’ has no member named ‘indexed_data’
pngquant.c:498: error: ‘png8_image’ has no member named ‘indexed_data’
pngquant.c:500: error: ‘png8_image’ has no member named ‘row_pointers’
pngquant.c:501: error: ‘png8_image’ has no member named ‘row_pointers’
pngquant.c: In function ‘pngquant_file’:
pngquant.c:520: error: ‘png24_image’ has no member named ‘file_size’
pngquant.c:520: error: ‘png24_image’ has no member named ‘gamma’
pngquant.c:531: error: ‘png8_image’ has no member named ‘row_pointers’
pngquant.c:549: error: ‘png8_image’ has no member named ‘fast_compression’
pngquant.c:561: error: ‘png24_image’ has no member named ‘row_pointers’
pngquant.c:562: error: ‘png24_image’ has no member named ‘rgba_data’
pngquant.c: In function ‘set_palette’:
pngquant.c:572: error: ‘png8_image’ has no member named ‘num_palette’
pngquant.c:573: error: ‘png8_image’ has no member named ‘num_trans’
pngquant.c:577: error: ‘png8_image’ has no member named ‘num_trans’
pngquant.c:579: error: ‘png8_image’ has no member named ‘palette’
pngquant.c:579: error: ‘png_color’ undeclared (first use in this function)
pngquant.c:579: error: (Each undeclared identifier is reported only once
pngquant.c:579: error: for each function it appears in.)
pngquant.c:579: error: expected ‘;’ before ‘{’ token
pngquant.c:580: error: ‘png8_image’ has no member named ‘trans’
pngquant.c: In function ‘write_image’:
pngquant.c:629: error: ‘png8_image’ has no member named ‘num_palette’
pngquant.c:644: error: ‘png8_image’ has no member named ‘num_palette’
pngquant.c: In function ‘read_image’:
pngquant.c:696: error: ‘png24_image’ has no member named ‘row_pointers’
pngquant.c:696: error: ‘png24_image’ has no member named ‘width’
pngquant.c:696: error: ‘png24_image’ has no member named ‘height’
pngquant.c:696: error: ‘png24_image’ has no member named ‘gamma’
pngquant.c:704: error: ‘png24_image’ has no member named ‘row_pointers’
pngquant.c:705: error: ‘png24_image’ has no member named ‘rgba_data’
pngquant.c: In function ‘prepare_output_image’:
pngquant.c:713: error: ‘png8_image’ has no member named ‘width’
pngquant.c:714: error: ‘png8_image’ has no member named ‘height’
pngquant.c:715: error: ‘png8_image’ has no member named ‘gamma’
pngquant.c:721: error: ‘png8_image’ has no member named ‘indexed_data’
pngquant.c:721: error: ‘png8_image’ has no member named ‘height’
pngquant.c:721: error: ‘png8_image’ has no member named ‘width’
pngquant.c:722: error: ‘png8_image’ has no member named ‘row_pointers’
pngquant.c:722: error: ‘png8_image’ has no member named ‘height’
pngquant.c:722: error: ‘png8_image’ has no member named ‘row_pointers’
pngquant.c:724: error: ‘png8_image’ has no member named ‘indexed_data’
pngquant.c:724: error: ‘png8_image’ has no member named ‘row_pointers’
pngquant.c:728: error: ‘png8_image’ has no member named ‘height’
pngquant.c:729: error: ‘png8_image’ has no member named ‘row_pointers’
pngquant.c:729: error: ‘png8_image’ has no member named ‘indexed_data’
pngquant.c:729: error: ‘png8_image’ has no member named ‘width’
pngquant.c:734: error: ‘png8_image’ has no member named ‘num_palette’
pngquant.c:735: error: ‘png8_image’ has no member named ‘num_trans’
pngquant.c:738: error: ‘png8_image’ has no member named ‘num_trans’
make: *** [pngquant.o] Error 1

✓ pngquant rebuilt successfully

stream.js:94
      throw er; // Unhandled stream error in pipe.
            ^
Error: invalid tar file
    at Extract.Parse._startEntry (/mnt/hgfs/workspace/http-poster/src/node_modules/grunt-contrib-imagemin/node_modules/gifsicle/node_modules/bin-build/node_modules/download/node_modules/decompress/node_modules/tar/lib/parse.js:145:13)
    at Extract.Parse._process (/mnt/hgfs/workspace/http-poster/src/node_modules/grunt-contrib-imagemin/node_modules/gifsicle/node_modules/bin-build/node_modules/download/node_modules/decompress/node_modules/tar/lib/parse.js:127:12)
    at BlockStream.<anonymous> (/mnt/hgfs/workspace/http-poster/src/node_modules/grunt-contrib-imagemin/node_modules/gifsicle/node_modules/bin-build/node_modules/download/node_modules/decompress/node_modules/tar/lib/parse.js:47:8)
    at BlockStream.EventEmitter.emit (events.js:95:17)
    at BlockStream._emitChunk (/mnt/hgfs/workspace/http-poster/src/node_modules/grunt-contrib-imagemin/node_modules/gifsicle/node_modules/bin-build/node_modules/download/node_modules/decompress/node_modules/tar/node_modules/block-stream/block-stream.js:145:10)
    at BlockStream.resume (/mnt/hgfs/workspace/http-poster/src/node_modules/grunt-contrib-imagemin/node_modules/gifsicle/node_modules/bin-build/node_modules/download/node_modules/decompress/node_modules/tar/node_modules/block-stream/block-stream.js:58:15)
    at Extract.Reader.resume (/mnt/hgfs/workspace/http-poster/src/node_modules/grunt-contrib-imagemin/node_modules/gifsicle/node_modules/bin-build/node_modules/download/node_modules/decompress/node_modules/tar/node_modules/fstream/lib/reader.js:255:34)
    at DirWriter.<anonymous> (/mnt/hgfs/workspace/http-poster/src/node_modules/grunt-contrib-imagemin/node_modules/gifsicle/node_modules/bin-build/node_modules/download/node_modules/decompress/node_modules/tar/lib/extract.js:57:8)
    at DirWriter.EventEmitter.emit (events.js:92:17)
    at /mnt/hgfs/workspace/http-poster/src/node_modules/grunt-contrib-imagemin/node_modules/gifsicle/node_modules/bin-build/node_modules/download/node_modules/decompress/node_modules/tar/node_modules/fstream/lib/dir-writer.js:39:8
npm ERR! weird error 8
✖ { [Error: Command failed: pngrtran.c:98: warning: ‘png_rtran_ok’ defined but not used
pngxmem.c: In function ‘pngx_malloc_rows_extended’:
pngxmem.c:37: warning: comparison is always false due to limited range of data type
ratio.c:25: error: conflicting types for ‘opng_longest_impl_t’
ratio.c:24: error: previous declaration of ‘opng_longest_impl_t’ was here
ratio.c:76: error: expected declaration specifiers or ‘...’ before ‘opng_ulongest_impl_t’
ratio.c:76: error: expected declaration specifiers or ‘...’ before ‘opng_ulongest_impl_t’
ratio.c: In function ‘opng_sprint_uratio_impl’:
ratio.c:90: error: ‘opng_ulongest_impl_t’ undeclared (first use in this function)
ratio.c:90: error: (Each undeclared identifier is reported only once
ratio.c:90: error: for each function it appears in.)
ratio.c:90: error: expected ‘;’ before ‘integer_part’
ratio.c:95: error: ‘denom’ undeclared (first use in this function)
ratio.c:97: error: ‘num’ undeclared (first use in this function)
ratio.c:117: error: ‘integer_part’ undeclared (first use in this function)
ratio.c:118: error: ‘remainder’ undeclared (first use in this function)
ratio.c: In function ‘opng_ulratio_to_factor_string’:
ratio.c:158: error: ‘opng_ulongest_impl_t’ undeclared (first use in this function)
ratio.c:158: error: expected ‘;’ before ‘num’
ratio.c:159: error: expected ‘;’ before ‘denom’
ratio.c:160: error: ‘num’ undeclared (first use in this function)
ratio.c:160: error: ‘denom’ undeclared (first use in this function)
ratio.c:160: error: too many arguments to function ‘opng_sprint_uratio_impl’
ratio.c:156: warning: unused parameter ‘ratio’
ratio.c: In function ‘opng_ulratio_to_percent_string’:
ratio.c:170: error: ‘opng_ulongest_impl_t’ undeclared (first use in this function)
ratio.c:170: error: expected ‘;’ before ‘num’
ratio.c:171: error: expected ‘;’ before ‘denom’
ratio.c:172: error: ‘num’ undeclared (first use in this function)
ratio.c:172: error: ‘denom’ undeclared (first use in this function)
ratio.c:172: error: too many arguments to function ‘opng_sprint_uratio_impl’
ratio.c:168: warning: unused parameter ‘ratio’
make[1]: *** [ratio.o] Error 1
make: *** [install] Error 2
] killed: false, code: 2, signal: null }
✔ optipng built successfully!
npm ERR! not ok code 0

Versions I'm using are:-

npm 1.3.11
node v0.1
CentOS release 5.10 (Final)

package.json

{
  "name": "httpclient",
  "version": "0.0.0",
  "dependencies": {},
  "devDependencies": {
    "grunt": "^0.4.4",
    "grunt-autoprefixer": "~0.4.0",
    "grunt-bower-install": "~1.0.0",
    "grunt-concurrent": "~0.5.0",
    "grunt-contrib-clean": "~0.5.0",
    "grunt-contrib-compass": "~0.7.2",
    "grunt-contrib-concat": "~0.3.0",
    "grunt-contrib-connect": "~0.5.0",
    "grunt-contrib-copy": "~0.4.1",
    "grunt-contrib-cssmin": "~0.7.0",
    "grunt-contrib-htmlmin": "~0.1.3",
    "grunt-contrib-imagemin": "~0.3.0",
    "grunt-contrib-jshint": "~0.7.1",
    "grunt-contrib-uglify": "~0.2.0",
    "grunt-contrib-watch": "~0.5.2",
    "grunt-google-cdn": "~0.2.0",
    "grunt-newer": "~0.6.1",
    "grunt-ngmin": "~0.0.2",
    "grunt-rev": "~0.1.0",
    "grunt-svgmin": "~0.2.0",
    "grunt-usemin": "~2.0.0",
    "jshint-stylish": "~0.1.3",
    "load-grunt-tasks": "~0.4.0",
    "time-grunt": "~0.2.1",
    "karma-ng-html2js-preprocessor": "^0.1.0",
    "karma-ng-scenario": "^0.1.0",
    "karma": "^0.12.16",
    "grunt-karma": "^0.8.3",
    "karma-jasmine": "^0.1.5",
    "karma-phantomjs-launcher": "^0.1.4",
    "grunt-cli": "~0.1.13",
    "bower": "~1.3.3"
  },
  "engines": {
    "node": ">=0.10.0"
  },
  "scripts": {
    "test": "grunt test"
  }
}

bower.json

{
  "name": "http-client",
  "version": "0.0.0",
  "dependencies": {
    "angular": "1.2.15",
    "json3": "~3.2.6",
    "es5-shim": "~2.1.0",
    "jquery": "~1.11.0",
    "bootstrap-sass-official": "~3.1.0",
    "angular-resource": "1.2.15",
    "angular-cookies": "1.2.15",
    "angular-sanitize": "1.2.15",
    "angular-route": "1.2.15",
    "zeroclipboard": "~1.3.5",
    "ng-clip": "~0.1.3",
    "underscore": "~1.6.0",
    "highlightjs": "~8.0.0",
    "angular-hotkeys": "chieffancypants/angular-hotkeys#~1.2.3",
    "moment": "~2.7.0"
  },
  "devDependencies": {
    "angular-mocks": "1.2.15",
    "angular-scenario": "1.2.15"
  }
}
Contributor

othiym23 commented Oct 3, 2014

  1. Please don't post issues onto closed, old threads – it spams everyone on the original thread, and more often than not, the new issue is unrelated to the old.
  2. This is an issue for imagemin's maintainers, not npm's.
  3. Your version of npm is obsolete and unsupported. Please upgrade to the newest stable npm.

@othiym23, inability to gracefully handle errors is an issue for npm.

/subscribe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment