question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using axios error

See original GitHub issue

Hi 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:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
harrisrobincommented, Feb 10, 2016

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

0reactions
jhen0409commented, Feb 11, 2016

Should we support json-loader as default loaders?

I think yes, because node require json file is natural, but it was broken by webpack.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found