2

OS: centos-release-6-10.el6.centos.12.3.x86_64

Node version: v8.11.1

NPM version: 5.6.0

package.json

{
  "private": true,
  "scripts": {
    "dev": "npm run development",
    "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch": "npm run development -- --watch",
    "watch-poll": "npm run watch -- --watch-poll",
    "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
    "prod": "npm run production",
    "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
  },
  "devDependencies": {
    "bootstrap-sass": "^3.3.7",
    "cross-env": "^5.2.0",
    "laravel-mix": "^2.0",
    "lodash": "^4.17.4"
  }
}

When I try to run npm install it stops with the following errors:-

⚠ The `/home/dipengrg/project/node_modules/pngquant-bin/vendor/pngquant` binary doesn't seem to work corr
ectly
  ⚠ pngquant pre-build test failed
  ℹ 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 (/home/dipengrg/project/node_modules/pngquant-bin/node_modules/bin-build/node_m
odules/execa/index.js:231:11)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
npm WARN ajv-keywords@3.2.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.3 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.3: wanted {"os":"darwin","arch":"any"} (c
urrent: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
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.

If I then try to install libpng-dev using npm install libpng-dev it reports:-

npm ERR! code E404
npm ERR! 404 Not Found: libpng-dev@latest

I followed tried this solution but problem still persists.

Dipendra Gurung
  • 5,720
  • 11
  • 39
  • 62

1 Answers1

3

Since you're running CentOS, the package you need is actually libpng-devel. You can install it by running yum -y install libpng-devel. libpng-dev is an Ubuntu/Debian package and it's pretty much the same as libpng-devel (for CentOS/RedHat distros). You're trying to install a linux package using npm so it's pretty obvious that you get a 404 (not found) error since that package does not exist for nodejs/npm.

So install libpng-devel first, then re-run the npm install and see how it goes.

Bogdan Stoica
  • 4,349
  • 2
  • 23
  • 38
  • I installed libpng-devel. But no luck! :/ I have updated error log. – Dipendra Gurung Aug 14 '18 at 06:11
  • Try installing these as well: `yum -y install libpng12-devel.x86_64 libpng-static.x86_64`. Also it seems you need to install some npm dependencies by running `npm install ajv`. It's quite hard to say what's the exact reason. Isn't there some more detailed error log? – Bogdan Stoica Aug 14 '18 at 06:31
  • I installed both libraries and even update the npm, but no gain. – Dipendra Gurung Aug 14 '18 at 07:26
  • As I was saying, a more detailed log is needed since it's pretty hard to guess what the reason might be... Some npm modules require the compilers installed so that might be an issue as well – Bogdan Stoica Aug 14 '18 at 07:28