Line 0: Parsing error: : Cannot read property ‘map’ of undefined
If you’re using React and typescript, try these few actions:
- Reinstall the dependencies:
rm -rf node_modules; yarn install
- Remove the cache that’s inside the
build
directory: remove thebuild
directory and restart the node service - This did it for me (and Trat Westerholt) : don’t type your variables/constants as ‘bare’ arrays:
This failed:
// don't do this - a 'bare' array as type
const customers: [] = []
SOLUTION: It was fixed by:
// add a type to the array
const customers: string[] = []