Stylus - Cannot read property 'x' of undefined

1.3k views Asked by At

When i try to compile .styl to .CSS, i get errors like this:

TypeError: css\style.styl:369:1
   365| /*footer*/
   366|         .footer
   367|                 {position: relative; bottom: 0; width: 100%;}
   368|         .footer p {}
   369|
--------^
Cannot read property 'block' of undefined

at Group.block (C:\Users\My Thinkpad\AppData\Roaming\npm\node_modules\stylus
\lib\nodes\group.js:48:23)
at Group.clone (C:\Users\My Thinkpad\AppData\Roaming\npm\node_modules\stylus
\lib\nodes\group.js:90:21)
at C:\Users\My Thinkpad\AppData\Roaming\npm\node_modules\stylus\lib\nodes\bl
ock.js:93:21
at Array.forEach (native)
at Block.clone (C:\Users\My Thinkpad\AppData\Roaming\npm\node_modules\stylus
\lib\nodes\block.js:92:14)
at Group.clone (C:\Users\My Thinkpad\AppData\Roaming\npm\node_modules\stylus
\lib\nodes\group.js:90:28)
at C:\Users\My Thinkpad\AppData\Roaming\npm\node_modules\stylus\lib\nodes\ro
ot.js:65:21
at Array.forEach (native)
at Root.clone (C:\Users\My Thinkpad\AppData\Roaming\npm\node_modules\stylus\
lib\nodes\root.js:64:14)
at MemoryCache.set (C:\Users\My Thinkpad\AppData\Roaming\npm\node_modules\st
ylus\lib\cache\memory.js:25:21)

So it says it couldn't read "block" from my .styl file but it points at the end of file!

What i did:

  • I've Carefully checked indents and removed whitespaces.
  • I've re-installed Stylus.
  • tried unindent like this but no luck:

    .footer

    {position: relative; bottom: 0; width: 100%;}

Specification:

  • Win7
  • Installed Stylus globally with npm

The question is how can i find what is wrong when it doesn't report anything usefull?

1

There are 1 answers

3
Panya On BEST ANSWER

Move {position: relative; bottom: 0; width: 100%;} at the same line as .footer. Stylus doesn't parse your code correctly because it thinks that {position: relative; bottom: 0; width: 100%;} is a nested selector with interpolation.