###### tags: `MERN`, `Debugging`, `JavaScript` # MERN Common Errors **Map is Not a Function** ![](https://i.imgur.com/lIqrZtw.png) .map function is **only** for arrays `[]` and this error occurs when the data you are iterating through is not a an array but another data structure like an object `{}`. To fix this, we need to change our data type to an array `[]`. First step is to identify our **state** that holds the data. <img src="https://i.imgur.com/wZYaDUZ.png" /> <img src="https://i.imgur.com/7iYeCd6.png" /> Here is an example of data pulling from our API: <img src="https://i.imgur.com/wmuBVQh.png" width="150px"/> Our error is in our setter: <img src="https://i.imgur.com/k8RoDSj.png" /> Notice the DATA CONTAINS AN OBJECT CALLED DATA, AND AN ARRAY CALLED DATA INSIDE THE DATA OBJECT. HERE IS THE FIX: ![](https://i.imgur.com/tpr77Tj.png) WE HAVE NOTATED CORRECTLY INTO THE BUCKET OF DATA, AND ARE NOW ABLE TO ITERATE OVER THE DATA BECAUSE IT IS NOW AN ARRAY **this section up above is not finished** --- ERROR -> "cannot find module..." ![](https://i.imgur.com/Y5MQ7JM.png) WHY? Pathing Issues, Please check your folder structure which should look something like this below: ![](https://i.imgur.com/gXDZBa7.png) ![](https://i.imgur.com/Av6AaXH.png) SOLUTION -> change your path url of the file you are trying to import by using dots and slashes, like this: ``` ./config/mongoose.config ``` ---