Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impossible to use Axios 0.27.0 with React #4620

Closed
JulSeb42 opened this issue Apr 25, 2022 · 2 comments
Closed

Impossible to use Axios 0.27.0 with React #4620

JulSeb42 opened this issue Apr 25, 2022 · 2 comments

Comments

@JulSeb42
Copy link

Describe the bug

I'm trying to install Axios 0.27.0 with React, but when I run npm start I get this error:

Module not found: Error: Can't resolve 'url' in '/path/to/node_modules/axios/lib/adapters'

To Reproduce

Just run npm i axios in your terminal, and npm start

Expected behavior

App running normally

Environment

  • Axios Version [0.27.0]
  • Adapter [e.g. XHR/HTTP]
  • Browser [Chrome]
  • Browser Version [100.0.4896.127]
  • Node.js Version [16.13.1]
  • OS: [macOS 12.3.1]
  • Additional Library Versions [React 18.0.0]
@github-actions
Copy link
Contributor

Hello! 👋

This issue is being automatically closed because it does not follow the issue template. Please read the issue template carefully and follow all of the instructions when opening a new issue.

Thanks

@DigitalBrainJS
Copy link
Collaborator

DigitalBrainJS commented Apr 25, 2022

You must set up global nodejs modules for your build tool. PR #3544 imports the entire 'url' module to validate url as I mentioned in #4594 where I tried to revert this change. As a result, Axios has become 2 times larger in size, and users now have to bundle nodejs globals in their client builds. ¯_(ツ)_/¯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants