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 'value' of undefined

See original GitHub issue

Issue

When using postcss v7.0.20 the webpack compilation fails with the following stack trace.

✖ 「wdm」: TypeError: Cannot read property 'value' of undefined
    at /Users/username/workspaces/terra/terra-core/9.css:220:3
    at new Quoted (/Users/username/workspaces/terra/terra-core/node_modules/postcss-values-parser/lib/nodes/Quoted.js:19:28)
    at cloneNode (/Users/username/workspaces/terra/terra-core/node_modules/postcss/lib/node.js:15:16)
    at Quoted.clone (/Users/username/workspaces/terra/terra-core/node_modules/postcss/lib/node.js:248:18)
    at Func.Node (/Users/username/workspaces/terra/terra-core/node_modules/postcss/lib/node.js:83:30)
    at new Container (/Users/username/workspaces/terra/terra-core/node_modules/postcss/lib/container.js:45:18)
    at new Container (/Users/username/workspaces/terra/terra-core/node_modules/postcss-values-parser/lib/nodes/Container.js:15:1)
    at new Func (/Users/username/workspaces/terra/terra-core/node_modules/postcss-values-parser/lib/nodes/Func.js:19:5)
    at asClonedNode (/Users/username/workspaces/terra/terra-core/node_modules/postcss-custom-properties/index.cjs.js:254:21)
    at array.map.node (/Users/username/workspaces/terra/terra-core/node_modules/postcss-custom-properties/index.cjs.js:250:60)
    at Array.map (<anonymous>)
    at asClonedArray (/Users/username/workspaces/terra/terra-core/node_modules/postcss-custom-properties/index.cjs.js:250:48)
    at asClonedArrayWithBeforeSpacing (/Users/username/workspaces/terra/terra-core/node_modules/postcss-custom-properties/index.cjs.js:240:23)
    at root.nodes.slice.forEach.child (/Users/username/workspaces/terra/terra-core/node_modules/postcss-custom-properties/index.cjs.js:213:44)
    at Array.forEach (<anonymous>)
    at transformValueAST (/Users/username/workspaces/terra/terra-core/node_modules/postcss-custom-properties/index.cjs.js:193:24)
    at root.walkDecls.decl (/Users/username/workspaces/terra/terra-core/node_modules/postcss-custom-properties/index.cjs.js:275:28)

Details

I have confirmed that this commit introduced this error by reverting to v7.0.19 and verifying no error was thrown and then again by upgrading to v7.0.20 and verifying the error is thrown. Additionally I manually updated the code within node_modules while using v7.0.20 to revert to the previous looping logic and verified no error was thrown.

for (let i of defaults[name]) this.append(i)

We’re still looking into exactly what is causing the error, but I wanted to make sure the issue was logged incase a quick solution/fix from the perspective of the maintainers of this library could be made.

Steps to Reproduce

(This is a rather large project, I’ll work on creating a smaller sample project)

  1. git clone https://github.com/cerner/terra-core.git
  2. cd terra-core
  3. npm install
  4. npm start
  5. Observe the stack trace above

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

24reactions
aicommented, Oct 25, 2019

The fix was released in 7.0.21

22reactions
aicommented, Oct 25, 2019

I am working on it 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot read property 'value' of Undefined in JS
To solve the "Cannot read property 'value' of undefined" error, make sure that the DOM element you are accessing exists. The error is...
Read more >
Uncaught TypeError: Cannot read property of undefined In
JavaScript TypeError is thrown when an operand or argument passed to a function is incompatible with the type expected by that operator or...
Read more >
Uncaught TypeError: Cannot read property 'value' of undefined
I have some JavaScript code that gives this error. Uncaught TypeError: Cannot read property 'value' of undefined.
Read more >
[SOLVED] Cannot Read Property of Undefined in JavaScript
The “cannot read property of undefined” error occurs when you attempt to access a property or method of a variable that is undefined...
Read more >
Uncaught TypeError : Cannot read properties of undefined
The root cause of the error is that the declared variable doesn't have any value, so by default, JavaScript treats all variables as...
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