discordjs / discord.js-modules

Modularisation of discord.js (WIP)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[@discordjs/rest] Error: Cannot find module 'timers/promises'

SergeyMC9730 opened this issue · comments

Please describe the problem you are having in as much detail as possible:
I installed @discordjs/rest and discord-api-types using npm install @discordjs/rest discord-api-types and tried to test my script, but its crashed because first module requires timers/promises:

~/bomedev $ node main
PID:  23982
internal/modules/cjs/loader.js:883
  throw err;
  ^

Error: Cannot find module 'timers/promises'
Require stack:
- /data/data/com.termux/files/home/bomedev/node_modules/@discordjs/rest/dist/lib/handlers/SequentialHandler.js
- /data/data/com.termux/files/home/bomedev/node_modules/@discordjs/rest/dist/lib/RequestManager.js
- /data/data/com.termux/files/home/bomedev/node_modules/@discordjs/rest/dist/index.js
- /data/data/com.termux/files/home/bomedev/main.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/data/data/com.termux/files/home/bomedev/node_modules/@discordjs/rest/dist/lib/handlers/SequentialHandler.js:6:20)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/data/data/com.termux/files/home/bomedev/node_modules/@discordjs/rest/dist/lib/handlers/SequentialHandler.js',
    '/data/data/com.termux/files/home/bomedev/node_modules/@discordjs/rest/dist/lib/RequestManager.js',
    '/data/data/com.termux/files/home/bomedev/node_modules/@discordjs/rest/dist/index.js',
    '/data/data/com.termux/files/home/bomedev/main.js'
  ]
}

I tried to install it, but got npm error:

~/bomedev $ npm install timers/promises
The authenticity of host 'github.com (140.82.121.4)' can't be established.a0904d
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
This key is not known by any other names
[..................] / rollbackFailedOptional: verb npm-session e5825b1858a0904d
[..................] / rollbackFailedOptional: verb npm-session e5825b1858a0904d
[..................] / rollbackFailedOptional: verb npm-session e5825b1858a0904d
npm ERR! Error while executing:
npm ERR! /data/data/com.termux/files/usr/bin/git ls-remote -h -t ssh://git@github.com/timers/promises.git
npm ERR! 
npm ERR! Host key verification failed.
npm ERR! fatal: Could not read from remote repository.
npm ERR! 
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR! 
npm ERR! exited with error code: 128

npm ERR! A complete log of this run can be found in:
npm ERR!     /data/data/com.termux/files/home/.npm/_logs/2021-08-29T04_24_51_437Z-debug.log

A complete log of this run: https://pastebin.com/2cSrguCJ

Include a reproducible code sample here, if possible:

var Discord = require('discord.js');
var { REST } = require('@discordjs/rest');
var { Routes } = require('discord-api-types/v9');

Further details:

  • discord.js version: 13.1.0
  • Node.js version: v14.15.4
  • Operating system: Android 8.0.0 arm + Termux 0.117
  • Priority this issue should have – please be realistic and elaborate if possible:

Relevant client options:

  • partials: none
  • gateway intents: none
  • other: none
commented

You need at least Node.js v16 for timers/promises.

thanks :)