Brandon Powell
Brandon Powell

Reputation: 99

Why is files saying Module not found: Can't resolve be?

Trying to import my folders but they keep on saying that cannot find folder but the folder I'm import is the correct:

./src/LoginPage/Login.js Module not found: Can't resolve '../_actions' in >'/Users/mirasmith/Desktop/KPV1-Project-master/src/LoginPage'

I don't know how to show the image so if someone can help fix it. Here the link to the folder hierarchy.

https://gyazo.com/410386debd550039400cf40e9e448196

Upvotes: 1

Views: 313

Answers (1)

Eric Jones
Eric Jones

Reputation: 76

Does _actions have a index.js? When require is given the path of a folder, it'll look for an index.js file in that folder. If there is one, it uses it. If not, it doesn't know what file you're trying to import.

If you don't have an index.js in there, you'll need something like: "import actions from ../_actions/filename.js"

If you are trying to do an import of all the files from a folder, this answer talks about how to do that:

https://stackoverflow.com/a/5365577/5216218

import alert from "../_actions/alert.actions.js" 
import user from "../_actions/user.actions.js"

Upvotes: 1

Related Questions