[Vuejs]-Syntax Error: TypeError: Cannot read properties of undefined (reading 'spaces') npm run serve vue

1👍

Generally this kind of error happens when you try to access a property of an object that does not (yet) exist.

So I think somewhere in your code you try to access someObject.spaces but someObject is undefined. To avoid this, you can add a simple if-clause before your operation:

if(someObject){
  doSomething(someObject.spaces)
}

I think you’ll have to fill in more code to identify exactly what happens, though.

Leave a comment