yugoccp/slack2discord

SyntaxError: Unexpected token '??=' error

Closed this issue · 2 comments

wishx commented

I tried to run slack2discord from the root of the backup folders and from each individual backup folder, but I always get the same error below. I'm using the s2d run -t <ENTER YOUR BOT TOKEN> -sid <ENTER YOUR SERVER ID> method, not the config file.

/usr/lib/node_modules/slack2discord/node_modules/@discordjs/rest/dist/index.js:754
  return cached ??= import("file-type");
                ^^^

SyntaxError: Unexpected token '??='
    at wrapSafe (internal/modules/cjs/loader.js:1001:16)
    at Module._compile (internal/modules/cjs/loader.js:1049:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:101:18)
    at Object.<anonymous> (/usr/lib/node_modules/slack2discord/node_modules/discord.js/src/client/BaseClient.js:4:18)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
wishx commented

The above issue was from NodeJS being version 12.x instead of 18.x, so I got that fixed, and it tried to parse all the files in a directory, then started spitting out the following:

/usr/lib/node_modules/slack2discord/node_modules/@sapphire/shapeshift/dist/index.js:1058
    return Result.err(new CombinedError(errors));
                      ^

CombinedError: Received one or more errors
    at UnionValidator.handle (/usr/lib/node_modules/slack2discord/node_modules/@sapphire/shapeshift/dist/index.js:1058:23)
    at UnionValidator.parse (/usr/lib/node_modules/slack2discord/node_modules/@sapphire/shapeshift/dist/index.js:113:88)
    at EmbedBuilder.setTimestamp (/usr/lib/node_modules/slack2discord/node_modules/@discordjs/builders/dist/messages/embed/Embed.cjs:81:35)
    at /usr/lib/node_modules/slack2discord/src/messageParser.js:133:25
    at Array.map (<anonymous>)
    at getEmbeds (/usr/lib/node_modules/slack2discord/src/messageParser.js:118:32)
    at /usr/lib/node_modules/slack2discord/src/messageParser.js:27:15
    at Array.reduce (<anonymous>)
    at Object.parseMessages (/usr/lib/node_modules/slack2discord/src/messageParser.js:15:24)
    at /usr/lib/node_modules/slack2discord/src/commands/parseMessages.js:28:44 {
  errors: [
    ExpectedValidationError: Expected values to be equals
        at LiteralValidator.handle (/usr/lib/node_modules/slack2discord/node_modules/@sapphire/shapeshift/dist/index.js:699:76)
        at LiteralValidator.run (/usr/lib/node_modules/slack2discord/node_modules/@sapphire/shapeshift/dist/index.js:99:23)
        at UnionValidator.handle (/usr/lib/node_modules/slack2discord/node_modules/@sapphire/shapeshift/dist/index.js:1053:32)
        at UnionValidator.parse (/usr/lib/node_modules/slack2discord/node_modules/@sapphire/shapeshift/dist/index.js:113:88)
        at EmbedBuilder.setTimestamp (/usr/lib/node_modules/slack2discord/node_modules/@discordjs/builders/dist/messages/embed/Embed.cjs:81:35)
        at /usr/lib/node_modules/slack2discord/src/messageParser.js:133:25
        at Array.map (<anonymous>)
        at getEmbeds (/usr/lib/node_modules/slack2discord/src/messageParser.js:118:32)
        at /usr/lib/node_modules/slack2discord/src/messageParser.js:27:15
        at Array.reduce (<anonymous>) {
      validator: 's.literal(V)',
      given: '2017-12-16T13:59:30.000Z',
      expected: null
    },
    ValidationError: Expected a number primitive
        at NumberValidator.handle (/usr/lib/node_modules/slack2discord/node_modules/@sapphire/shapeshift/dist/index.js:866:70)
        at NumberValidator.run (/usr/lib/node_modules/slack2discord/node_modules/@sapphire/shapeshift/dist/index.js:99:23)
        at UnionValidator.handle (/usr/lib/node_modules/slack2discord/node_modules/@sapphire/shapeshift/dist/index.js:1053:32)
        at UnionValidator.parse (/usr/lib/node_modules/slack2discord/node_modules/@sapphire/shapeshift/dist/index.js:113:88)
        at EmbedBuilder.setTimestamp (/usr/lib/node_modules/slack2discord/node_modules/@discordjs/builders/dist/messages/embed/Embed.cjs:81:35)
        at /usr/lib/node_modules/slack2discord/src/messageParser.js:133:25
        at Array.map (<anonymous>)
        at getEmbeds (/usr/lib/node_modules/slack2discord/src/messageParser.js:118:32)
        at /usr/lib/node_modules/slack2discord/src/messageParser.js:27:15
        at Array.reduce (<anonymous>) {
      validator: 's.number',
      given: '2017-12-16T13:59:30.000Z'
    },
    ValidationError: Expected a Date
        at DateValidator.handle (/usr/lib/node_modules/slack2discord/node_modules/@sapphire/shapeshift/dist/index.js:636:66)
        at DateValidator.run (/usr/lib/node_modules/slack2discord/node_modules/@sapphire/shapeshift/dist/index.js:99:23)
        at UnionValidator.handle (/usr/lib/node_modules/slack2discord/node_modules/@sapphire/shapeshift/dist/index.js:1053:32)
        at UnionValidator.parse (/usr/lib/node_modules/slack2discord/node_modules/@sapphire/shapeshift/dist/index.js:113:88)
        at EmbedBuilder.setTimestamp (/usr/lib/node_modules/slack2discord/node_modules/@discordjs/builders/dist/messages/embed/Embed.cjs:81:35)
        at /usr/lib/node_modules/slack2discord/src/messageParser.js:133:25
        at Array.map (<anonymous>)
        at getEmbeds (/usr/lib/node_modules/slack2discord/src/messageParser.js:118:32)
        at /usr/lib/node_modules/slack2discord/src/messageParser.js:27:15
        at Array.reduce (<anonymous>) {
      validator: 's.date',
      given: '2017-12-16T13:59:30.000Z'
    }
  ]
}

Node.js v18.10.0

Yup @wishx ! Thanks for reporting, fixed it on version 1.0.8.

Looking forward!