0

I am using React in VS code, and I am trying to import the following modules:

import React from 'react';
import axios from 'axios';

I am able to successfully import React, but when I import axios, I get a Module not found error.

./src/components/UploadForm.js Module not found: Can't resolve 'axios' in '/Users/jsmith/upload-file/upload-file/src/components'

My program fails to compile, and I am not sure how to fix this. This happens for a few other modules as well.

2 Answers 2

1

You may have forgotten to install the axios package, if so, run below command.

npm install axios
Sign up to request clarification or add additional context in comments.

Comments

0

You first have to install axios

yarn add axios

then you import

import axios from 'axios';

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.