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.

JisonLexerError: Lexical error on line 1: Unrecognized text

See original GitHub issue

I’ve got a NextJS project where I’m using withCss and withSass that seems to use postcss-calc to during the project’s build.

When building I’ve got the following error as soon as I use calc functions:

> Failed to build
{ JisonLexerError: Lexical error on line 1: Unrecognized text.

  Erroneous area:
1: 100VH - 30px
^..^
    at /home/qlerebours/Projects/TraveledMap/traveledmap/src/app/static/chunks/styles.2606b0eb.chunk.css:8106:7
    at Object.parseError (/home/qlerebours/Projects/TraveledMap/traveledmap/src/app/node_modules/postcss-calc/dist/parser.js:1164:15)
    at Object.lexer_parseError [as parseError] (/home/qlerebours/Projects/TraveledMap/traveledmap/src/app/node_modules/postcss-calc/dist/parser.js:2297:44)
    at Object.lexer_next [as next] (/home/qlerebours/Projects/TraveledMap/traveledmap/src/app/node_modules/postcss-calc/dist/parser.js:3292:22)
    at Object.lexer_fastLex [as fastLex] (/home/qlerebours/Projects/TraveledMap/traveledmap/src/app/node_modules/postcss-calc/dist/parser.js:3367:18)
    at fastLex (/home/qlerebours/Projects/TraveledMap/traveledmap/src/app/node_modules/postcss-calc/dist/parser.js:1567:27)
    at Parser.parse (/home/qlerebours/Projects/TraveledMap/traveledmap/src/app/node_modules/postcss-calc/dist/parser.js:1641:30)
    at /home/qlerebours/Projects/TraveledMap/traveledmap/src/app/node_modules/postcss-calc/dist/lib/transform.js:30:30
    at walk (/home/qlerebours/Projects/TraveledMap/traveledmap/src/app/node_modules/postcss-value-parser/lib/walk.js:19:7)
    at ValueParser.walk (/home/qlerebours/Projects/TraveledMap/traveledmap/src/app/node_modules/postcss-value-parser/lib/index.js:18:3)
    at transformValue (/home/qlerebours/Projects/TraveledMap/traveledmap/src/app/node_modules/postcss-calc/dist/lib/transform.js:24:50)
    at _default (/home/qlerebours/Projects/TraveledMap/traveledmap/src/app/node_modules/postcss-calc/dist/lib/transform.js:59:100)
    at /home/qlerebours/Projects/TraveledMap/traveledmap/src/app/node_modules/postcss-calc/dist/index.js:25:51
    at /home/qlerebours/Projects/TraveledMap/traveledmap/src/app/node_modules/postcss/lib/container.js:135:18
    at Rule.each (/home/qlerebours/Projects/TraveledMap/traveledmap/src/app/node_modules/postcss/lib/container.js:101:16)
    at Rule.walk (/home/qlerebours/Projects/TraveledMap/traveledmap/src/app/node_modules/postcss/lib/container.js:131:17)
    at /home/qlerebours/Projects/TraveledMap/traveledmap/src/app/node_modules/postcss/lib/container.js:148:24
  hash: 
   { errStr: 'Lexical error on line 1: Unrecognized text.\n\n  Erroneous area:\n1: 100VH - 30px\n^..^',
     recoverable: false,
     text: '',
     token: null,
     line: 0,
     loc: 
      { first_line: 1,
        first_column: 0,
        last_line: 1,
        last_column: 0,
        range: [Array] },
     yy: 
      { parseError: undefined,
        quoteName: undefined,
        lexer: undefined,
        parser: undefined,
        pre_parse: undefined,
        post_parse: undefined,
        pre_lex: undefined,
        post_lex: undefined },
     lexer: 
      { yy: {},
        __decompressed: true,
        _input: '',
        yytext: '',
        yyleng: 0,
        match: '',
        matches: false,
        _more: false,
        _backtrack: false,
        yylloc: [Object],
        _signaled_error_token: false,
        done: false,
        yylineno: 0,
        matched: '',
        conditionStack: [Array],
        __currentRuleSet__: null,
        offset: 0 },
     destroy: [Function: destructLexErrorInfo] },
  postcssNode: 
   Declaration {
     raws: { before: '\n      ', between: ':' },
     type: 'decl',
     parent: 
      Rule {
        raws: [Object],
        type: 'rule',
        nodes: [Array],
        parent: [Object],
        source: [Object],
        selector: '.bottom-content-wrapper .slider-wrapper.visible',
        lastEach: 9,
        indexes: [Object] },
     source: { start: [Object], input: [Object], end: [Object] },
     prop: 'max-height',
     value: 'calc(100VH - 30px)' } }
error Command failed with exit code 1.

The source code:

&.visible {
      height: 165px;
      max-height: calc(100VH - 30px);
}

The chunk.css file:

.bottom-content-wrapper .slider-wrapper.visible {
      height: 165px;
      max-height: calc(100VH - 30px); }

This is not the first time that I have this error, as I said as soon as I want to use calc, my build fails because of this error

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

18reactions
eitchescommented, Apr 8, 2020

@kevinisaac https://github.com/creativetimofficial/ct-light-bootstrap-dashboard-pro-react/issues/37

I just found your post so help you. use #{} in calc statement like this calc(100vh - #{$headerheight})

I’ve also tried this and done compile and deploy with Nuxt.js successfully.

4reactions
nachogarciacommented, Mar 17, 2020

Same here, using Nuxt. min-height: calc(100vh - $footer-height - $header-height - $header-margin);

Read more comments on GitHub >

github_iconTop Results From Across the Web

Lexical error on line 1: Unrecognized text. Erroneous area: 1: 0
When I run build, it fails because of Lexical error on line 1: Unrecognized text. Erroneous area: 1: 0 - none. No idea...
Read more >
compilation issues [#3250654] | Drupal.org
Hi! v1.1.1 no error with gulp sass compilation v1.1.2 i get this error. ... "gulp-postcss" Message: Lexical error on line 1: Unrecognized text....
Read more >
Error in Bootstrap files when compiling assets. - Laracasts
I googled it and found that running npm run prod shows the error that doesn't let it compile. ... Lexical error on line...
Read more >
[Solved]-Lexical error on line 1: Unrecognized text. Erroneous ...
Coding example for the question Lexical error on line 1: Unrecognized text. Erroneous area: 1: 0 - none. Heroku, Scss, React-Reactjs.
Read more >
Lexical error on line 1: Unrecognized text Erroneous area:\n1 ...
JisonLexerError : Lexical error on line 1: Unrecognized text Erroneous area:\n1: 100VH - 44px. langyalaoa 于 2022-03-31 15:06:35 发布 334 收藏.
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