jestins's avatar

Issue with mix install on centos 6

Once I finished in my local(Windows) everything is working as expected, but when I try to do npm install in the server with non-root user it's throwing this error.

    Error: pngquant failed to build, make sure that libpng-dev is installed
    at Promise.all.then.arr (/home/***/node_modules/pngquant-bin/node_modules/bin-build/node_modules/execa/index.js:231:11)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:118:7)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node lib/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

If I run the same with root user it works.

Anyone knows the issue.?

libpng-dev is already installed in server, I tried lot of solution and none helps.

0 likes
7 replies
rin4ik's avatar

yes it is permission problem run via root user npm install like in ubuntu sudo npm install

jestins's avatar

I can't run it from root user since it's running from deploybot(Auto deploy). I need to know is it possible to overwrite the permission for this user.

amitbhatia's avatar

You have to install build-essential

sudo apt install build-essential

1 like
bensholdice's avatar

this is a problem with the dependencies of a dependency. pngquant needs pngquant-bin and npm detects it is not present (problem #1) and tries to build it, but fails (problem #2)

to fix problem #1 you could install the binary rpm - as the npm error suggest. But strangely the centos package is named libpng-devel not libpng-dev (as it is on debian (apt) based systems). I found I could get it installed like so:

yum install libpng libpng-devel libpng12 libpng12-devel

problem #2 is a bigger issue. I dont want build tools on my prod server. Something changed for centos based laravel systems (recently, in 5.6) and after too many hours chasing why npm install on a stock 5.6 install fails I gave up and installed gcc/make/glibc-headers etc

CorCronje's avatar

As @amitbhatia said,

installing build-essential on Ubuntu 8.04 using npm v5.60 and node v8.11.3 resolved the issue for me.

Regards

southcoastkenny's avatar

Hi,

I have managed to get this working on centos7 running WHM/Cpanel.

Firstly I had to ssh to the server as 'root'. As the root user I navigated to my laravel folder and did a normal 'npm-install' I then had to install my node packages with a 'npm install react-router-dom etc..'

Then I ssh as the user account, navigated to my laravel directory and 'npm run watch' works perfectly.

Any extra node packages would again need to be installed as root also else they have a permissions issue.

Hope this helps.

Please or to participate in this conversation.