Chan Ung Chris Jeong
Chan Ung Chris Jeong

Reputation: 29

nodejs iconv invalid ELF header error

I'm checking on my local(mac terminal, with node web.js)

and I checked it is running on local server.

However, when I deploy it to the server, it keeps making error as

Error: /home/hosting_users//apps//node_modules/iconv/build/Release/iconv.node: invalid ELF header

In details,ERROR LOG

How can I make it running on the server?

have no idea please help.

This code is what I use Iconv in my code.

const Iconv = require('iconv').Iconv;

var iconv = new Iconv('euc-kr', 'utf-8//translit//ignore');

var option = {
    url: url,
    transform: function(body) {
        return cheerio.load(iconv.convert(body).toString());
    },
    encoding: null
};

Thanks,

Upvotes: 1

Views: 2004

Answers (1)

mscdex
mscdex

Reputation: 106726

If you copy your node_modules directory to a different platform (e.g. Mac to Linux, Linux to Windows, etc.), you need to recompile any binary addons. You should be able to accomplish this by doing npm rebuild.

In this specific situation, you could use iconv-lite instead which does not require compilation and seems to be faster than iconv.

Upvotes: 2

Related Questions