slackapi / node-slack-sdk

Slack Developer Kit for Node.js
https://tools.slack.dev/node-slack-sdk/
MIT License
3.28k stars 661 forks source link

RTM API client not working #538

Closed shauryam closed 6 years ago

shauryam commented 6 years ago

Description

Unable to require Client Modules using Node.js

What type of issue is this? (place an x in one of the [ ])

Requirements (place an x in each of the [ ])


Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

Reproducible in:

@slack/client version: 4.1.0

node version:

OS version(s): 4.7.0

Steps to reproduce:

After downloading node modules using npm install @slack/client --save, when I try to require Client module using:

const RTMClient = require("@slack/client"); or const RTMClient = require("@slack/client").RtmClient; or var CLIENT_EVENTS = require("@slack/client").CLIENT_EVENTS;

Expected result:

Module should get imported

Actual result:

/Users/xyz/Documents/Chatbot/slackbot/node_modules/@slack/client/dist/logger.js:64
      return function(...msg) {
                      ^^^

SyntaxError: Unexpected token ...
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/Users/xyz/Documents/Chatbot/slackbot/node_modules/@slack/client/dist/index.js:3:16)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)

Attachments:

Logs, screenshots, screencast, sample project, funny gif, etc.

image

aoberoi commented 6 years ago

@shauryam it looks like you’re trying to use this package with the v3 API after updating to v4.

Check out the migration guide to update your code accordingly. Alternatively you could downgrade your version of @slack/client to the latest v3.