npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

npm install fails on pngquant-bin


I have recently come across an issue with npm and my Windows 10 PC at my development job that I can’t resolve and I’m hoping someone here can point me in the right direction.

My development stack is as follows:
XAMPP (latest version - currently 7.2.8)
Apache 2.4
PHP 7.2.8
Composer 1.7.1
Laravel 5.6
Node.js - 10.8.0
npm - 6.2.0
phpstorm - 2018.2

I am trying to perform the following:

I can successfully perform these actions on other machines as follows:

I have also tried installing this under a different user profile on the same physical workstation. It also failed in that instance. So I am fairly confident the issue is related to this Win10 PC.

I have uninstalled all parts of the development stack mentioned above and re-installed them, but the behavior does not change.

All of the answers I found via Googling (mostly stackexchange) point to solutions for an Ubuntu system related to installing libpng-dev, however no solutions on how to resolve for Windows 10. Any help or guidance would be very appreciated.


> pngquant-bin@4.0.0 postinstall C:\xampp\htdocs\nodetestapp\node_modules\pngquant-bin
> node lib/install.js

  ‼ Client network socket disconnected before secure TLS connection was established
  ‼ pngquant pre-build test failed
  i compiling from source
  √ pngquant pre-build test passed successfully
  × Error: pngquant failed to build, make sure that libpng-dev is installed
    at Promise.all.then.arr (C:\xampp\htdocs\nodetestapp\node_modules\pngquant-bin\node_modules\bin-build\node_modules\execa\index.js:231:11)
    at process._tickCallback (internal/process/next_tick.js:68:7)
npm verb lifecycle pngquant-bin@4.0.0~postinstall: unsafe-perm in lifecycle true
npm verb lifecycle pngquant-bin@4.0.0~postinstall: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin... [truncated]
npm verb lifecycle pngquant-bin@4.0.0~postinstall: CWD: C:\xampp\htdocs\nodetestapp\node_modules\pngquant-bin
npm timing audit submit Completed in 1274ms
npm http fetch POST 200 1273ms
npm timing audit body Completed in 0ms
npm info lifecycle pngquant-bin@4.0.0~postinstall: Failed to exec postinstall script
npm timing action:postinstall Completed in 64605ms
npm verb unlock done using C:\Users\t.frappier\AppData\Roaming\npm-cache\_locks\staging-75dd9ecf86d3f9ca.lock for C:\xampp\htdocs\nodetestapp\node_modules\.staging
npm timing stage:rollbackFailedOptional Completed in 145ms
npm timing stage:runTopLevelLifecycles Completed in 69718ms

npm verb stack Error: pngquant-bin@4.0.0 postinstall: `node lib/install.js`
npm verb stack Exit status 1
npm verb stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:304:16)
npm verb stack     at EventEmitter.emit (events.js:182:13)
npm verb stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
npm verb stack     at ChildProcess.emit (events.js:182:13)
npm verb stack     at maybeClose (internal/child_process.js:962:16)
npm verb stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:249:5)
npm verb pkgid pngquant-bin@4.0.0
npm verb cwd C:\xampp\htdocs\nodetestapp
npm verb Windows_NT 10.0.16299
npm verb argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--verbose"
npm verb node v10.8.0
npm verb npm  v6.2.0
npm ERR! errno 1
npm ERR! pngquant-bin@4.0.0 postinstall: `node lib/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the pngquant-bin@4.0.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm verb exit [ 1, true ]
npm timing npm Completed in 70602ms

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\t.frappier\AppData\Roaming\npm-cache\_logs\2018-08-09T15_27_44_536Z-debug.log

After two days of troubleshooting we have resolved this. The root cause was content filtering on our network proxy. Once we added the problematic workstation to a group that is not subject to the content filtering rules, the npm install began to work.

Unfortunately, I am not the network admin and was not provided with more specifisc as to which content filtering rules were in place and caused the issue.