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???

- 4,716
- 2
- 18
- 30

- 21
- 1
- 3
-
it says that the package : libpng-dev is missing .. install it before runing npm install – Roland Allla Jan 10 '20 at 12:48
-
"removed node_modules then reinstall it but working"; Is it working or not? – thmspl Jan 10 '20 at 13:00
-
sorry typo missing ,not working – ArunPandian Jayaram Jan 10 '20 at 13:02
3 Answers
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

- 3,346
- 2
- 17
- 35
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.

- 1
- 2
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

- 4,643
- 3
- 19
- 39