Using axios error
See original GitHub issueHi I have a rest api and I want to use a library called Axios to do ajax requests on my api but when I tried adding the package npm install axios --save
and import it into one of my component import axios from 'axios'
it gives me this error
ERROR in ./~/axios/package.json
Module parse failed: /Users/alleoindong/Public/projects/restoko/restoko-desktop-app/node_modules/axios/package.json Line 2: Unexpected token :
You may need an appropriate loader to handle this file type.
| {
| "_args": [
| [
| "axios@^0.8.1",
@ ./~/axios/lib/adapters/http.js 11:10-41
any work around or hints of the problem? Thank you so much for helping!
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Handling Errors | Axios Docs
Using the validateStatus config option, you can define HTTP code(s) that should throw an error. ... Using toJSON you get an object with...
Read more >Handling Errors With Axios - Stack Abuse
This error is most commonly caused by a bad/spotty network, a hanging backend that does not respond instantly to each request, unauthorized or ......
Read more >Axios handling errors - Stack Overflow
I'm trying to understand javascript promises better with Axios. What I pretend is to handle all errors in Request.js and only call the ......
Read more >How to handle errors with Axios request - Educative.io
Overview. We can add the catch function to the axios request to handle the error response for the sent request. The catch function...
Read more >Error Handling in Axios using `catch()` - Mastering JS
Axios requests are promises, which means they have a then() function for promise chaining, and a catch() function for handling errors.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
None of the solutions mentioned above solved it for me. Could someone guide me to an example of this boilerplate using axios or any other HTTP library? Would be much appreciated! Thanks
I think yes, because node require json file is natural, but it was broken by webpack.