-1

I'm creating a laravel application with react template, when I run npm install throws an error exception, I also tried changing folder permissions, removed node_modules then reinstalled it but not working any solutions???

error

Chris32
  • 4,716
  • 2
  • 18
  • 30

3 Answers3

1

Judging by the error I see in your console:

pngquant failed to build, make sure that libpng-dev is installed

Seems like you don't have a pngquant package installed. Try the following steps:

Install package locally:

sudo apt-get install libpng-dev

Install npm package:

npm install -g pngquant-bin

If you already have node_modules directory in your project, delete it and install node_modules again:

npm install
zlatan
  • 3,346
  • 2
  • 17
  • 35
0

According to Image Provided, Everything seems to be fine until it hits this missing package causing the exception to be thrown.

The missing package is libpng-dev: A virtual package.

See the Debian policy for a definition of virtual packages. You can see here for details.


You have to Run this Command

sudo apt-get install libpng-dev

In case you hit an error saying it has been installed before, It means you have installed another build of this package. Hence, you have to reinstall it.

sudo apt-get install --reinstall libpng12-0=1.2.51-0ubuntu3

And then, try running npm install

I hope it works.

Oluwatobi
  • 1
  • 2
0

I solved similar issue in my localhost environment by moving libraries from devDependencies{} into dependencies{}

Otherwise

You should set global Node environment called NODE_ENV to development

NODE_ENV=development

References

How to set NODE_ENV to production/development in OS X

Environment variables in Node.js. The Right way!

Foued MOUSSI
  • 4,643
  • 3
  • 19
  • 39