Skip to content
This repository has been archived by the owner on Mar 17, 2023. It is now read-only.

Module build failed: Error: dyld: Library not loaded: /usr/local/opt/libpng/lib/libpng16.16.dylib #60

Closed
mrdulin opened this issue Dec 21, 2016 · 6 comments

Comments

@mrdulin
Copy link

mrdulin commented Dec 21, 2016

full error:

ERROR in ./src/images/bg.jpg
Module build failed: Error: dyld: Library not loaded: /usr/local/opt/libpng/lib/libpng16.16.dylib
  Referenced from: /Users/dulin/workspace/webpack-summer/node_modules/mozjpeg/vendor/cjpeg
  Reason: image not found

    at Promise.all.then.arr (/Users/dulin/workspace/webpack-summer/node_modules/execa/index.js:170:11)
    at process._tickCallback (internal/process/next_tick.js:103:7)
 @ ../~/css-loader!./src/style.css 6:100-126

it seems not support jpg image?

@tcoopman
Copy link
Owner

Can you post your webpack config?
And what version are you using?

@tcoopman
Copy link
Owner

Duplicate of #51

@mrdulin
Copy link
Author

mrdulin commented Dec 27, 2016

@tcoopman

const htmlWebpackPlugin = require('html-webpack-plugin');
var CleanWebpackPlugin = require('clean-webpack-plugin');
var path = require('path');

module.exports = {
    entry: './src',
    output: {
        path: 'dist',
        filename: 'bundle.[hash].js'
    },
    module: {
        loaders: [{
            test: /.*\.(gif|png|jpe?g|svg)$/i,
            exclude: /node_modules/,
            loaders: [
                'file?hash=sha512&digest=hex&name=images/[name].[hash:8].[ext]',
                'image-webpack'
            ]
        }, {
            test: /\.css$/,
            exclude: /node_modules/,
            loader: 'style!css'
        }]
    },
    imageWebpackLoader: {
        mozjpeg: {
            quality: 65
        },
        pngquant: {
            quality: "65-90",
            speed: 4
        }
    },
    plugins: [
        new CleanWebpackPlugin('dist', {
            root: __dirname,
            verbose: true,
            dry: false
        }),
        new htmlWebpackPlugin({
            template: './src/index.html'
        })
    ]
}

@tcoopman
Copy link
Owner

@mrdulin. Thanks, it's a duplicate bug of #51
Maybe you can check over there how you can fix it.

@jose920405
Copy link

Just need update it with brew.

brew reinstall libpng

@SebastianoF
Copy link

To solve the problem I applied the following workaround (that is not optimal, but it is doing the job).

  1. locate libpng16.16.dylib in the system with
find /opt -name "libpng16.16.dylib"

that turned out to be under /opt/X11/lib/ in my system.

  1. make a symlink of "libpng16.16.dylib" where required:
sudo ln -s /opt/X11/lib/libpng16.16.dylib /usr/local/opt/libpng/lib/libpng16.16.dylib

Note that before step 2, you may need to create the folders /usr/local/opt/libpng/lib/ if not present, with:

sudo mkdir -p /usr/local/opt/libpng/lib/

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants