Giter Site home page Giter Site logo

Comments (2)

boahs avatar boahs commented on August 18, 2024

Have you tried using a previous version of got? see: #76

I also suggest you check const id = "..."; and be sure your user ID value is correct. You can find a user ID by using the user lookup endpoint.

from twitter-api-v2-sample-code.

beverand avatar beverand commented on August 18, 2024

I did try to run this code and found that it did not work. The error I got was this:
const got = require('got');
^
Error [ERR_REQUIRE_ESM]: require() of ES Module
/testwit/node_modules/got/dist/source/index.js from
/testwit/example2.js not supported.

Instead change the require of index.js in /testwit/example2.js to a dynamic import() which is available in all CommonJS modules.

at Object.<anonymous> (/testwit/example2.js:1:13) {

code: 'ERR_REQUIRE_ESM'
}

Made these changes to the declarations at the top of the file and added "type":"module" to the package.json and it worked successfully:
import got from 'got';
import crypto from 'crypto';
import OAuth from 'oauth-1.0a';
import qs from 'querystring';
import rl from 'readline';

const readline = rl.createInterface({
input: process.stdin,
output: process.stdout
});

@SamaaElKomy, I think it might be something with your keys as to why you got that particular error.

from twitter-api-v2-sample-code.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.