0

Hi i'm facing somewhat a strange problem during $npm run serve

enter image description here

here is my page structure

<template>
  <div>
    ...
  </div>
</template>

<script>
export default {
   name: 'game',
   ...
}
</script>

<style lang="scss" scoped>
 $variable1:#fff;
 ....
</style>

My package.json looks something like this

"devDependencies":{
    "node-sass": "^6.0.0",
    "sass-loader": "^10.1.0",
    "vue-loader-v16": "npm:vue-loader@^16.1.1"
}

3 Answers 3

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.

Sign up to request clarification or add additional context in comments.

Comments

0

Check your styles U should use

::v-deep() { a { color: red; }}

instead of

::v-deep { a { color: red; }}

more info https://github.com/vuejs/core/issues/4745

Comments

0

I think you did not define the state in the right way

I suppose that somewhere you call spaces like this game.spaces with defining game: undefined. The right way to define the game state with a default value is an empty object like this:

<script>
export default {
   name: 'game',
   data(){
      game: {}
   }
}
</script>

Or You can use ?. Optional chaining to avoid this error like game?.spaces. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.