FruitieX/teleirc

I can't use teleirc after installation

neoranger opened this issue · 8 comments

I tried to install teleirc from npm but when i execute teleirc i get this error:

user@hostname:~/home/user/teleirc $ teleirc -vvv
info: using config file from: /home/pi/.teleirc/config.js
info: forcing log level to "silly"

/usr/local/lib/node_modules/teleirc/node_modules/node-telegram-bot-api/node_modules/request/node_modules/hawk/node_modules/boom/lib/index.js:5
const Hoek = require('hoek');
^^^^^
SyntaxError: Use of const in strict mode.
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/teleirc/node_modules/node-telegram-bot-api/node_modules/request/node_modules/hawk/lib/index.js:5:33)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/teleirc/node_modules/node-telegram-bot-api/node_modules/request/request.js:9:12)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)

When i run: sudo npm install -g teleirc

user@hostname:~/Documents/git/teleirc $ sudo npm install -g teleirc
npm WARN engine irc-colors@1.3.3: wanted: {"node":">=0.12"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine shelljs@0.7.7: wanted: {"node":">=0.11.0","iojs":"*"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine request@2.82.0: wanted: {"node":">= 4"} (current: {"node":"0.10.29","npm":"1.4.21"})

> node-icu-charset-detector@0.2.0 install /usr/local/lib/node_modules/teleirc/node_modules/irc/node_modules/node-icu-charset-detector
> node-gyp rebuild

make: Entering directory '/usr/local/lib/node_modules/teleirc/node_modules/irc/node_modules/node-icu-charset-detector/build'
  CXX(target) Release/obj.target/node-icu-charset-detector/node-icu-charset-detector.o
In file included from ../node-icu-charset-detector.cpp:2:0:
../node_modules/nan/nan.h:326:47: error: ‘REPLACE_INVALID_UTF8’ is not a member of ‘v8::String’
   static const unsigned kReplaceInvalidUtf8 = v8::String::REPLACE_INVALID_UTF8;
                                               ^
node-icu-charset-detector.target.mk:80: recipe for target 'Release/obj.target/node-icu-charset-detector/node-icu-charset-detector.o' failed
make: *** [Release/obj.target/node-icu-charset-detector/node-icu-charset-detector.o] Error 1
make: Leaving directory '/usr/local/lib/node_modules/teleirc/node_modules/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/share/node-gyp/lib/build.js:267:23)
 ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:809:12)
gyp ERR! System Linux 4.9.35-v7+
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/teleirc/node_modules/irc/node_modules/node-icu-charset-detector
gyp ERR! node -v v0.10.29
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm WARN engine form-data@2.3.1: wanted: {"node":">= 0.12"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine har-validator@5.0.3: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine hawk@6.0.2: wanted: {"node":">=4.5.0"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine har-schema@2.0.0: wanted: {"node":">=4"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm WARN engine boom@4.3.1: wanted: {"node":">=4.0.0"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine sntp@2.0.2: wanted: {"node":">=4.0.0"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine cryptiles@3.1.2: wanted: {"node":">=4.0.0"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine hoek@4.2.0: wanted: {"node":">=4.0.0"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN optional dep failed, continuing node-icu-charset-detector@0.2.0
npm WARN engine boom@5.2.0: wanted: {"node":">=4.0.0"} (current: {"node":"0.10.29","npm":"1.4.21"})
npm WARN engine co@4.6.0: wanted: {"iojs":">= 1.0.0","node":">= 0.12.0"} (current: {"node":"0.10.29","npm":"1.4.21"})
/
> iconv@2.2.3 install /usr/local/lib/node_modules/teleirc/node_modules/irc/node_modules/iconv
> node-gyp rebuild

make: Entering directory '/usr/local/lib/node_modules/teleirc/node_modules/irc/node_modules/iconv/build'
  CXX(target) Release/obj.target/iconv/src/binding.o
In file included from ../src/binding.cc:18:0:
../node_modules/nan/nan.h:326:47: error: ‘REPLACE_INVALID_UTF8’ is not a member of ‘v8::String’
   static const unsigned kReplaceInvalidUtf8 = v8::String::REPLACE_INVALID_UTF8;
                                               ^
iconv.target.mk:89: recipe for target 'Release/obj.target/iconv/src/binding.o' failed
make: *** [Release/obj.target/iconv/src/binding.o] Error 1
make: Leaving directory '/usr/local/lib/node_modules/teleirc/node_modules/irc/node_modules/iconv/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/share/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:809:12)
gyp ERR! System Linux 4.9.35-v7+
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/teleirc/node_modules/irc/node_modules/iconv
gyp ERR! node -v v0.10.29
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm WARN optional dep failed, continuing iconv@2.2.3
/usr/local/bin/teleirc -> /usr/local/lib/node_modules/teleirc/bin/teleirc
teleirc@0.4.6 /usr/local/lib/node_modules/teleirc
├── os-homedir@1.0.2
├── irc-colors@1.3.3
├── mkdirp@0.5.1 (minimist@0.0.8)
├── node-static@0.7.10 (mime@1.4.0, colors@1.1.2, optimist@0.6.1)
├── winston@2.3.1 (cycle@1.0.3, stack-trace@0.0.10, eyes@0.1.8, isstream@0.1.2, async@1.0.0, colors@1.0.3)
├── yargs@4.8.1 (get-caller-file@1.0.2, decamelize@1.2.0, which-module@1.0.0, set-blocking@2.0.0, y18n@3.2.1, window-size@0.2.0, require-main-filename@1.0.1, lodash.assign@4.2.0, require-directory@2.1.1, yargs-parser@2.4.1, os-locale@1.4.0, string-width@1.0.2, cliui@3.2.0, read-pkg-up@1.0.1)
├── git-rev-sync@1.9.1 (escape-string-regexp@1.0.5, graceful-fs@4.1.11, shelljs@0.7.7)
├── node-telegram-bot-api@0.21.1 (file-type@3.9.0, mime@1.4.0, debug@2.6.9, bluebird@2.11.0, request@2.82.0)
├── lodash@4.17.4
└── irc@0.5.2

Try this @neoranger
Solution provided by @kala725 (thanks) here

Try running the following commands and then run npm install, this will take the node's default node-gyp module. (No need to have multiple as node package already provides that)

Updating the node & NPM

sudo npm cache clean -f
sudo npm install -g n
sudo n 4.4.5
sudo npm install npm -g

Removing additional Node-gyp module

sudo npm uninstall node-gyp -g
sudo npm uninstall node-gyp

I get the same error. Please help me.

I have two ideas:

  1. You are missing the package libicu-dev (Debian) and should try installing it.
  2. Ỳour node is nodejs and there is no binary node. I usually fix it with sudo ln -s /usr/bin/nodejs /usr/local/bin/node.

@Mikaela I do that and still don't work. I already have the node file. I changed the name and i create the simlink an the error still the same.

/usr/local/lib/node_modules/teleirc/node_modules/node-telegram-bot-api/node_modules/request/node_modules/hawk/node_modules/boom/lib/index.js:5
const Hoek = require('Hoek');
^^^^^

@neoranger this smells of classic node.js version issues. The fact it is calling out const suggests that you are using a version of node.js that wants var rather than the newer support in ES6 for let/const.

Can you check your version of node and also npm? It is worth mentioning that you should check these both without sudo and with sudo as there can be a mismatch between the two.

Also what operating system are you using? I've seen this issue a lot when installing node.js utilising apt based packages just as nodejs-legacy. To @Mikaela's point if you are hitting node vs nodejs path issues then I'd be very sure that this is a version issue based on package managed installations of node.

As a general recommendation for anyone reading I would always go with NVM or N to do your node.js management, this way you switch version you need to use and also do very quick checks/guarantees. In my production applications I use pm2 ecosystem files which allow me to switch node.js version with NVM to ensure I'm compatible at runtime.

Update:

I've seen in the logs posted:
gyp ERR! node -v v0.10.29 gyp ERR! node-gyp -v v0.12.2

Thats a very old version of node by today's standards circa 2015 with about 10% support for ES2015 and likely just before any basic const support.

Here is a SO question and answer - you will need to use harmony support to open up the experimental features if you wish to continue on using that version: https://stackoverflow.com/questions/22603078/syntaxerror-use-of-const-in-strict-mode

@ImTheDeveloper Im using teleirc in my raspberry pi 2B with Raspbian. I get this error when i update the teleirc repository. Before all was ok.

$ nodejs --version
v0.10.29

$ npm --version
ERROR: npm is known not to run on Node.js v0.10.29
You'll need to upgrade to a newer version in order to use this
version of npm. Supported versions are 4, 6, 7, 8. You can find the
latest version at https://nodejs.org/

Yes you need to upgrade your version of node.