ekmartin / slack-irc

Connects Slack and IRC channels by sending messages back and forth.
MIT License
587 stars 155 forks source link

npm install fails #108

Closed Kabouik closed 8 years ago

Kabouik commented 8 years ago

Hi there,

First of all, I'm a complete noob. I don't know how to use npm or how it works, I'm just an IRC user following some how-to because I would like to use Slack, and therefore merge an IRC channel of friends (on Quakenet.org) with the Slack team I've just created, so that my friends can decide whether they migrate to Slack too or stick to their IRC client. I don't own any server, I don't know if it is a prerequisite for using slack-irc. I'm sorry if my questions are stupid, or if I'm doing it totally wrong.

So I've created a Slack bot and invited it to my Slack team #general channel. I've also created a ~/myself/.slack-irc/conf.json file using the given channels and the bot's token.

Now I am trying to install slack-irc, but get the following error when trying to install it:

sudo npm install -g slack-irc npm http GET https://registry.npmjs.org/slack/client/2.3.0 npm http GET https://registry.npmjs.org/check-env/1.2.0 npm http GET https://registry.npmjs.org/commander/2.9.0 npm http GET https://registry.npmjs.org/irc/0.5.0 npm http GET https://registry.npmjs.org/lodash/4.11.1 npm http GET https://registry.npmjs.org/strip-json-comments/2.0.1 npm http GET https://registry.npmjs.org/winston/2.2.0 npm http 304 https://registry.npmjs.org/check-env/1.2.0 npm http 304 https://registry.npmjs.org/commander/2.9.0 npm http 304 https://registry.npmjs.org/lodash/4.11.1 npm http 304 https://registry.npmjs.org/irc/0.5.0 npm http 304 https://registry.npmjs.org/strip-json-comments/2.0.1 npm http 304 https://registry.npmjs.org/winston/2.2.0 npm http 404 https://registry.npmjs.org/slack/client/2.3.0 npm ERR! 404 'slack' is not in the npm registry. npm ERR! 404 You should bug the author to publish it npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, or http url, or git url. npm ERR! System Linux 4.4.0-13-generic npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "slack-irc" npm ERR! cwd /home/mathieu/.slack-irc npm ERR! node -v v0.10.25 npm ERR! npm -v 1.3.10 npm ERR! code E404 npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /home/mathieu/.slack-irc/npm-debug.log npm ERR! not ok code 0

I have tried searching this error on Google, but have not found anything relevant so far. I really have no idea what I am doing wrong, and feel like I'm trying to venture in a playground I don't belong to, but it's worth asking help in case the solution is simple enough for me. :)

Thanks in advance!

ekmartin commented 8 years ago

Hi, don't be sorry!

I don't own any server, I don't know if it is a prerequisite for using slack-irc.

You can use your own PC as a server, but then you have to keep it on all the time. If you have experience with Linux I'd recommend getting a DigitalOcean droplet, and set it up there. If you get it working on your own PC it should be pretty much the same. If you have any questions while you go along I'd be glad to answer them in slack-irc's Gitter-channel.

As for your error, it's probably because you have an ancient Node.js/npm version. Looks like you're using a Linux distro from the error output, so try following the instructions for upgrading here: https://github.com/nodesource/distributions

Kabouik commented 8 years ago

Thanks a lot for your answer @ekmartin.

I upgraded node.js using the link you provided, and managed to install slack-irc using sudo npm install -g slack-irc, although there were a few errors:

~/.slack-irc $ sudo npm install -g slack-irc
npm WARN lifecycle slack-irc@3.7.8~prepublish: cannot run in wd %s %s (wd=%s) slack-irc@3.7.8 npm run build /home/mathieu/.slack-irc/slack-irc
/usr/bin/slack-irc -> /usr/lib/node_modules/slack-irc/dist/index.js
> iconv@2.1.11 install /usr/lib/node_modules/slack-irc/node_modules/iconv
> node-gyp rebuild
make: entrant dans le répertoire « /usr/lib/node_modules/slack-irc/node_modules/iconv/build »
  CC(target) Release/obj.target/libiconv/deps/libiconv/lib/iconv.o
  AR(target) Release/obj.target/iconv.a
  COPY Release/iconv.a
  CXX(target) Release/obj.target/iconv/src/binding.o
  SOLINK_MODULE(target) Release/obj.target/iconv.node
  COPY Release/iconv.node
make: quittant le répertoire « /usr/lib/node_modules/slack-irc/node_modules/iconv/build »
> node-icu-charset-detector@0.1.4 install /usr/lib/node_modules/slack-irc/node_modules/node-icu-charset-detector
> node-gyp rebuild
make: entrant dans le répertoire « /usr/lib/node_modules/slack-irc/node_modules/node-icu-charset-detector/build »
  CXX(target) Release/obj.target/node-icu-charset-detector/node-icu-charset-detector.o
../node-icu-charset-detector.cpp:7:28: fatal error: unicode/ucsdet.h: Aucun fichier ou dossier de ce type
 #include <unicode/ucsdet.h>
compilation terminated.
make: *** [Release/obj.target/node-icu-charset-detector/node-icu-charset-detector.o] Erreur 1
make: quittant le répertoire « /usr/lib/node_modules/slack-irc/node_modules/node-icu-charset-detector/build »
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:100:13)
gyp ERR! stack     at ChildProcess.emit (events.js:185:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
gyp ERR! System Linux 4.4.0-13-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/lib/node_modules/slack-irc/node_modules/node-icu-charset-detector
gyp ERR! node -v v5.10.1
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok 
npm WARN install:node-icu-charset-detector@0.1.4 node-icu-charset-detector@0.1.4 install: `node-gyp rebuild`
npm WARN install:node-icu-charset-detector@0.1.4 Exit status 1
/usr/lib
└─┬ slack-irc@3.7.8 
  ├─┬ @slack/client@2.3.0 
  │ ├── async@1.5.2 
  │ ├── bluebird@3.3.5 
  │ ├── eventemitter3@1.2.0 
  │ ├─┬ https-proxy-agent@1.0.0 
  │ │ ├─┬ agent-base@2.0.1 
  │ │ │ └── semver@5.0.3 
  │ │ ├─┬ debug@2.2.0 
  │ │ │ └── ms@0.7.1 
  │ │ └── extend@3.0.0 
  │ ├── inherits@2.0.1 
  │ ├── lodash@3.10.1 
  │ ├─┬ request@2.72.0 
  │ │ ├── aws-sign2@0.6.0 
  │ │ ├─┬ aws4@1.3.2 
  │ │ │ └─┬ lru-cache@4.0.1 
  │ │ │   ├── pseudomap@1.0.2 
  │ │ │   └── yallist@2.0.0 
  │ │ ├─┬ bl@1.1.2 
  │ │ │ └─┬ readable-stream@2.0.6 
  │ │ │   ├── core-util-is@1.0.2 
  │ │ │   ├── isarray@1.0.0 
  │ │ │   ├── process-nextick-args@1.0.6 
  │ │ │   ├── string_decoder@0.10.31 
  │ │ │   └── util-deprecate@1.0.2 
  │ │ ├── caseless@0.11.0 
  │ │ ├─┬ combined-stream@1.0.5 
  │ │ │ └── delayed-stream@1.0.0 
  │ │ ├── forever-agent@0.6.1 
  │ │ ├── form-data@1.0.0-rc4 
  │ │ ├─┬ har-validator@2.0.6 
  │ │ │ ├─┬ chalk@1.1.3 
  │ │ │ │ ├── ansi-styles@2.2.1 
  │ │ │ │ ├── escape-string-regexp@1.0.5 
  │ │ │ │ ├─┬ has-ansi@2.0.0 
  │ │ │ │ │ └── ansi-regex@2.0.0 
  │ │ │ │ ├── strip-ansi@3.0.1 
  │ │ │ │ └── supports-color@2.0.0 
  │ │ │ ├─┬ is-my-json-valid@2.13.1 
  │ │ │ │ ├── generate-function@2.0.0 
  │ │ │ │ ├─┬ generate-object-property@1.2.0 
  │ │ │ │ │ └── is-property@1.0.2 
  │ │ │ │ ├── jsonpointer@2.0.0 
  │ │ │ │ └── xtend@4.0.1 
  │ │ │ └─┬ pinkie-promise@2.0.1 
  │ │ │   └── pinkie@2.0.4 
  │ │ ├─┬ hawk@3.1.3 
  │ │ │ ├── boom@2.10.1 
  │ │ │ ├── cryptiles@2.0.5 
  │ │ │ ├── hoek@2.16.3 
  │ │ │ └── sntp@1.0.9 
  │ │ ├─┬ http-signature@1.1.1 
  │ │ │ ├── assert-plus@0.2.0 
  │ │ │ ├─┬ jsprim@1.2.2 
  │ │ │ │ ├── extsprintf@1.0.2 
  │ │ │ │ ├── json-schema@0.2.2 
  │ │ │ │ └── verror@1.3.6 
  │ │ │ └─┬ sshpk@1.7.4 
  │ │ │   ├── asn1@0.2.3 
  │ │ │   ├─┬ dashdash@1.13.0 
  │ │ │   │ └── assert-plus@1.0.0 
  │ │ │   ├── ecc-jsbn@0.1.1 
  │ │ │   ├── jodid25519@1.0.2 
  │ │ │   ├── jsbn@0.1.0 
  │ │ │   └── tweetnacl@0.14.3 
  │ │ ├── is-typedarray@1.0.0 
  │ │ ├── json-stringify-safe@5.0.1 
  │ │ ├─┬ mime-types@2.1.10 
  │ │ │ └── mime-db@1.22.0 
  │ │ ├── node-uuid@1.4.7 
  │ │ ├── oauth-sign@0.8.1 
  │ │ ├── qs@6.1.0 
  │ │ ├── stringstream@0.0.5 
  │ │ ├── tough-cookie@2.2.2 
  │ │ └── tunnel-agent@0.4.2 
  │ ├── retry@0.8.0 
  │ ├── url-join@0.0.1 
  │ └─┬ ws@1.1.0 
  │   ├── options@0.0.6 
  │   └── ultron@1.0.2 
  ├── check-env@1.2.0 
  ├─┬ commander@2.9.0 
  │ └── graceful-readlink@1.0.1 
  ├─┬ irc@0.5.0 
  │ ├─┬ iconv@2.1.11 
  │ │ └── nan@2.0.9 
  │ └─┬ irc-colors@1.2.1 
  │   └─┬ hashish@0.0.4 
  │     └── traverse@0.6.6 
  ├── lodash@4.11.1 
  ├── strip-json-comments@2.0.1 
  └─┬ winston@2.2.0 
    ├── async@1.0.0 
    ├── colors@1.0.3 
    ├── cycle@1.0.3 
    ├── eyes@0.1.8 
    ├── isstream@0.1.2 
    ├── pkginfo@0.3.1 
    └── stack-trace@0.0.9 

Some errors are in French, sorry. I can translate if you see something that needs attention.

I tried to run slack-irc --config config.json anyway, and it shows no error (it shows nothing at all actually) and I can see my bot connecting to the #general channel in Slack, so I guess it's a progress already. However, I don't see it connecting to the IRC channel, and there is no mirroring. I probably did something wrong in the config file:

[
// Bot (advanced options):
  {
    "nickname": "lambot",
    "server": "irc.quakenet.org:7000",
    "token": "TOKEN", // Your bot user's token
    "autoSendCommands": [ // Commands that will be sent on connect
     ["PRIVMSG", "NickServ", "IDENTIFY password"],
     ["MODE", "test", "+x"],
     ["AUTH", "test", "password"]
    ],
    "channelMapping": { // Maps each Slack-channel to an IRC-channel, used to direct messages to the correct place
      "#general": "#OurIRCChan" // Add channel keys after the channel name
    },
    "ircOptions": { // Optional node-irc options
      "floodProtection": false, // On by default
      "floodProtectionDelay": 1000 // 500 by default
    },
    // Makes the bot hide the username prefix for messages that start
    // with one of these characters (commands):
    "commandCharacters": ["!", "."],
    // Prevent messages posted by Slackbot (e.g. Slackbot responses)
    // from being posted into the IRC channel:
    "muteSlackbot": true, // Off by default
    // Sends messages to Slack whenever a user joins/leaves an IRC channel:
    "ircStatusNotices": {
      "join": true, // Don't send messages about joins
      "leave": true
    }
  }
]

As for DigitalOcean droplets, thanks for the tip! I did not know such services existed. Unfortunately, even the cheapest plan at $5/month is a bit expensive for my use, i.e. just a group chat for 4-5 friends. A free alternative with very low hardware would be nice.

ekmartin commented 8 years ago

The errors are just warnings in a 3rd party package, nothing to worry about. Try changing your server hostname to "server": "irc.quakenet.org",, i.e. without the port. If you really need to set the port you can do so through "ircOptions": { "port": 7000 } }.

Are you a student? If you are you can get $50 in DigitalOcean credits from GitHub: https://education.github.com/pack

Kabouik commented 8 years ago

I tried without the server port in an earlier attempt but it did not work, this is why I tried with the port. I'll try again tonight at home but I will be running Windows this time so I will have to start over.

Not student anymore, no discount! :]

ekmartin commented 8 years ago

I see. If you run slack-irc like this: NODE_ENV=development slack-irc --config config.json you should get some more debug output. It should run on Windows too, but I haven't set it up there before (might be a bit harder).

Kabouik commented 8 years ago

I got it working on Windows doing exactly what I did one hour ago on Linux. I guess it was mainly an issue with my work network preventing connection of the bot to irc.quakenet.org (although I was connected as user, which is weird).

Working very well! Thanks a lot for this. :]

ekmartin commented 8 years ago

No problem - glad you got it working!