FeedHive / twitter-api-client

A user-friendly Node.js / JavaScript client library for interacting with the Twitter API.
MIT License
948 stars 83 forks source link

Installation twitter-api-client #109

Open jesusdra opened 2 years ago

jesusdra commented 2 years ago

I have installed the library in my vue 3 project, when importing it I get the following errors:

" ERROR Failed to compile with 5 errors 12:32:51

error in ./node_modules/oauth/lib/oauth.js

Module not found: Error: Can't resolve 'crypto' in 'C:\projectJorge\project-jorge\node_modules\oauth\lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

Module not found: Error: Can't resolve 'http' in 'C:\projectJorge\project-jorge\node_modules\oauth\lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

Module not found: Error: Can't resolve 'https' in 'C:\projectJorge\project-jorge\node_modules\oauth\lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

Module not found: Error: Can't resolve 'url' in 'C:\projectJorge\project-jorge\node_modules\oauth\lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

Module not found: Error: Can't resolve 'querystring' in 'C:\projectJorge\project-jorge\node_modules\oauth\lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

ERROR in ./node_modules/oauth/lib/oauth.js 3:13-30 Module not found: Error: Can't resolve 'crypto' in 'C:\projectJorge\project-jorge\node_modules\oauth\lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

ERROR in ./node_modules/oauth/lib/oauth.js 5:11-26 Module not found: Error: Can't resolve 'http' in 'C:\projectJorge\project-jorge\node_modules\oauth\lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

ERROR in ./node_modules/oauth/lib/oauth.js 6:12-28 Module not found: Error: Can't resolve 'https' in 'C:\projectJorge\project-jorge\node_modules\oauth\lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

ERROR in ./node_modules/oauth/lib/oauth.js 7:10-24 Module not found: Error: Can't resolve 'url' in 'C:\projectJorge\project-jorge\node_modules\oauth\lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

ERROR in ./node_modules/oauth/lib/oauth.js 8:18-40 Module not found: Error: Can't resolve 'querystring' in 'C:\projectJorge\project-jorge\node_modules\oauth\lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

ERROR in ./node_modules/oauth/lib/oauth2.js 1:18-40 Module not found: Error: Can't resolve 'querystring' in 'C:\projectJorge\project-jorge\node_modules\oauth\lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

ERROR in ./node_modules/oauth/lib/oauth2.js 2:13-30 Module not found: Error: Can't resolve 'crypto' in 'C:\projectJorge\project-jorge\node_modules\oauth\lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

ERROR in ./node_modules/oauth/lib/oauth2.js 3:12-28 Module not found: Error: Can't resolve 'https' in 'C:\projectJorge\project-jorge\node_modules\oauth\lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

ERROR in ./node_modules/oauth/lib/oauth2.js 4:11-26 Module not found: Error: Can't resolve 'http' in 'C:\projectJorge\project-jorge\node_modules\oauth\lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

ERROR in ./node_modules/oauth/lib/oauth2.js 5:10-24 Module not found: Error: Can't resolve 'url' in 'C:\projectJorge\project-jorge\node_modules\oauth\lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

webpack compiled with 10 errors"

I don't know exactly the reason for this error, it's driving me crazy and I don't know how to fix it. Node V: 16.17.0 NPM 8.15.0

zyhzyh0333 commented 1 year ago

My react project has the same problem. Already mad.

jesusdra commented 1 year ago

I have not been able to do that and I have given up.

zyhzyh0333 commented 1 year ago

Actually, this problem is due to the webpack, I'm using React, and the version of "react-script" (5.0.0) leads to the problem. This step can be solved by following this link: https://stackoverflow.com/questions/73317870/cant-resolve-querystring-in-react

However, after solving this part, there's also another big issue, which is the CROS block. It seems that Twitter API doesn't allow calling it from the frontend. I'm able to make everything run in my local Node.js, but adding it to React project turns out to be totally different. Even the easiest way, using https request, also failed.

So, one solution might be building a local Node.js server, and connecting it to the react frontend. It's too difficult for me to get it done two days before the ddl, so I'm not sure this will work properly as expected.