question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Cannot read property 'lang' of null

See original GitHub issue

I am trying out your webpack template to use jest for unit testing in a new little app and am getting this error when running npm run unit:

 FAIL  test/unit/specs/App.spec.js
  ● Test suite failed to run

    TypeError: Cannot read property 'lang' of null

      at processScript (node_modules/jest-vue/lib/process.js:13:17)
      at Object.module.exports [as process] (node_modules/jest-vue/lib/process.js:27:18)
      at Object.<anonymous> (test/unit/specs/App.spec.js:1:114)

I reduced the file to an absolute minimum and I’m still getting the error.

App.spec.js

import App from '@/App'

App.vue

<template>
  <div id="app">
  </div>
</template>

package.json

...
"jest": "^21.2.0",
"jest-vue": "^0.7.0",
...

This is the offending line in jest-vue/lib/process.js:

function processScript (scriptPart) {
  if (scriptPart.lang === 'typescript' || scriptPart.lang === 'ts') {

Which seems to make sense since I do not define a lang attribute on my script tags.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:23 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
caioincaucommented, Nov 6, 2017

It worked 😄

2reactions
agualiscommented, Nov 6, 2017

@icaioincau Try again changing your template to <template functional>...</template>

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: Cannot read property of null - iDiallo
This error occurs when you read a property or call a method on a null object . That's because the DOM API returns...
Read more >
TypeError: Cannot read properties of null (reading 'user')
I want to get (mohammad) in my console but when I use: console.log(user.user.name), I give TypeError: Cannot read properties of null ...
Read more >
How to deal with TypeError: cannot read properties of null
While coding in Javascript, you must have at least once received a Type Error which has the message “cannot read properties of null”....
Read more >
Throwing an Error "cannot read property style of null" in ...
When we are trying to access one property i.e. either doesn't contain any value (not even defined properly) in it or it is...
Read more >
Resolving "Cannot call method * of null" or "Cannot read ...
If you are seeing these typeErrors in your logs, the root cause of the issue is that the object that you are attempting...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found