Weird 'Module not found: Can't resolve' error

I know this is common issue that is generally solvable by checking the imports thoroughly, but for some reason, I just can't see what is wrong with mine:

The full error reads:

Module not found: Can't resolve './components/Book' in '/Users/../src/components'

Yet my BookShelf.js file's imports are as follows:

import React from 'react'
import PropTypes from 'prop-types'
import Book from './components/Book'

Any ideas as to why this is happening would be greatly appreciated! Thanks in advance!

2 answers

  • answered 2018-10-11 19:58 Eugene Tsakh

    Seems like your Book and BookShelf components are located in components folder so your import should be import Book from './Book'

  • answered 2018-10-11 19:58 SLaks

    Read the error more carefully.

    You're importing from /Users/.../src/components. There is no ./components subdirectory of that (since you're already in that directory).