Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module not found: Error: Can't resolve '../build/Debug/iconv.node' in '....\angular-electron\node_modules\irc\node_modules\iconv\lib' (webpack?) #531

Open
Booster2ooo opened this issue Mar 4, 2018 · 3 comments

Comments

@Booster2ooo
Copy link

Hello, I came across a weird behavior with irc module, iconv and webpack.
When simply using irc module with nodejs, I've got no problem so far.
But, if I try to use it in an Angular5 Electron app, webpack fails to compile:

ERROR in ./node_modules/irc/node_modules/iconv/lib/iconv.js
Module not found: Error: Can't resolve '../build/Debug/iconv.node' in '...\angular-electron\node_modules\irc\node_modules\iconv\lib'

webpack: Failed to compile.

I had a look, the iconv.node is present (in Release/), i tried to recompile iconv with differents params but still got the error.

So, I tracked the error down to those lines:

Client.prototype.convertEncoding = function(str) {
    var self = this, out = str;

    if (self.opt.encoding) {
        try {
            var charsetDetector = require('node-icu-charset-detector');
            var Iconv = require('iconv').Iconv;
            var charset = charsetDetector.detectCharset(str);
            var converter = new Iconv(charset.toString(), self.opt.encoding);

            out = converter.convert(str);
        } catch (err) {
            if (self.opt.debug) {
                util.log('\u001b[01;31mERROR: ' + err + '\u001b[0m');
                util.inspect({ str: str, charset: charset });
            }
        }
    }

    return out;
};

If I comment the try/catch part, webpack compiles with no error:

Client.prototype.convertEncoding = function(str) {
    var self = this, out = str;

    if (self.opt.encoding) {
        // try {
            // var charsetDetector = require('node-icu-charset-detector');
            // var Iconv = require('iconv').Iconv;
            // var charset = charsetDetector.detectCharset(str);
            // var converter = new Iconv(charset.toString(), self.opt.encoding);

            // out = converter.convert(str);
        // } catch (err) {
            if (self.opt.debug) {
                util.log('\u001b[01;31mERROR: ' + err + '\u001b[0m');
                util.inspect({ str: str, charset: charset });
            }
        //}
    }

    return out;
};

Env:
Win 10 x64
node v8.9.4 x64
npm v5.6.0
node-gyp v3.6.2
irc 0.5.2
electron 1.8.2
angular/cli: 1.7.1
ngtools/webpack: 1.10.1

@matt1
Copy link

matt1 commented Jul 20, 2018

Same issue here, also on Win10x64

@cbartondock
Copy link

Exact same issue in 2020. What the heck?

@Booster2ooo
Copy link
Author

The project isn't maintained anymore I'm afraid.

There are some forks that might be a better options for now, like
https://www.npmjs.com/package/funsocietyirc-client
https://www.npmjs.com/package/irc-upd

Or an alternative
https://github.com/kiwiirc/irc-framework

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

No branches or pull requests

3 participants