html-validator icon indicating copy to clipboard operation
html-validator copied to clipboard

TypeError: rawLines.split is not a function

Open sawa-ko opened this issue 2 years ago • 8 comments

Version

module: 1.5.1 nuxt: 3.6.2

Nuxt configuration

mode:

  • [x] universal
  • [ ] spa

Nuxt configuration

htmlValidator: {
    usePrettier: true,
    options: {
      rules: {
        'heading-level': ['warn', { allowMultipleH1: true }],
      },
      elements: [
        'html5',
        {
          a: {
            permittedDescendants: ['@flow', 'button'],
          },
          button: {
            permittedContent: ['@flow', 'div'],
          },
        },
      ],
    },
}

What is expected?

No errors.

What is actually happening?

The following error is currently displayed in the nuxt server console:

[nitro] [unhandledRejection] TypeError: rawLines.split is not a function
    at codeFrameColumns (C:\Users\inmor\Documents\personal\dashboard\node_modules\.pnpm\@[email protected]\node_modules\@babel\code-frame\lib\index.js:81:26)
    at formatMessage (c:\Users\inmor\Documents\personal\dashboard\node_modules\.pnpm\[email protected]\node_modules\html-validate\dist\es\core.js:12345:21)
    at c:\Users\inmor\Documents\personal\dashboard\node_modules\.pnpm\[email protected]\node_modules\html-validate\dist\es\core.js:12383:23
    at Array.map (<anonymous>)
    at c:\Users\inmor\Documents\personal\dashboard\node_modules\.pnpm\[email protected]\node_modules\html-validate\dist\es\core.js:12382:42
    at Array.reduce (<anonymous>)
    at codeframe (c:\Users\inmor\Documents\personal\dashboard\node_modules\.pnpm\[email protected]\node_modules\html-validate\dist\es\core.js:12381:10)
    at checkHTML (C:\Users\inmor\Documents\personal\dashboard\node_modules\.pnpm\@[email protected]\node_modules\@nuxtjs\html-validator\dist\runtime\validator.mjs:31:41)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {stack: 'TypeError: rawLines.split is not a function
 …ions (node:internal/process/task_queues:95:5)', message: 'rawLines.split is not a function'}

The error seems to come from the html-validate package.

Steps to reproduce

Additional information

Checklist

  • [x] I have tested with the latest Nuxt version and the issue still occurs
  • [x] I have tested with the latest module version and the issue still occurs
  • [x] I have searched the issue tracker and this issue hasn't been reported yet

Steps to reproduce

  1. Create a nuxt project
  2. Run nuxt server
  3. See error in server console

sawa-ko avatar Jul 14 '23 18:07 sawa-ko

same issue here.

module: 1.5.1 nuxt: 3.6.2

mattgrah-am avatar Jul 21 '23 00:07 mattgrah-am

same issue here.

module: 1.5.2 nuxt: 3.6.5

using pnpm

pisandelli avatar Jul 24 '23 18:07 pisandelli

I noticed that removing the option usePrettier the error disappear.

pisandelli avatar Aug 16 '23 14:08 pisandelli

do you have tailwind in your project?

thunfisch987 avatar Sep 09 '23 21:09 thunfisch987

from the docs:

"usePrettier enables prettier printing of your source code to show errors in-context.

Consider not enabling this if you are using TailwindCSS, as prettier will struggle to cope with parsing the size of your HTML in development mode."

thunfisch987 avatar Sep 09 '23 21:09 thunfisch987

Hi there, im facing the same problem and not using TailwindCSS (im using vuetify if it helps)

abbytec avatar Nov 12 '23 04:11 abbytec

@thunfisch987 no tailwind

pisandelli avatar Feb 01 '24 19:02 pisandelli

I have this issue too with usePrettier option and without tailwind.

[nitro] [unhandledRejection] TypeError: rawLines.split is not a function
    at codeFrameColumns (/home/personal/Localhost/project/node_modules/@babel/code-frame/src/index.ts:157:26)
    at formatMessage (/home/personal/Localhost/project/node_modules/src/formatters/codeframe.ts:101:4)
    at <anonymous> (/home/personal/Localhost/project/node_modules/src/formatters/codeframe.ts:155:15)
    at Array.map (<anonymous>)
    at <anonymous> (/home/personal/Localhost/project/node_modules/src/formatters/codeframe.ts:154:37)
    at Array.reduce (<anonymous>)
    at codeframe (/home/personal/Localhost/project/node_modules/src/formatters/codeframe.ts:153:4)
    at checkHTML (/home/personal/Localhost/project/node_modules/@nuxtjs/html-validator/dist/runtime/validator.mjs:31:41)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

DraftProducts avatar Mar 06 '24 11:03 DraftProducts

I believe this should be resolved in 19e3eaf99960b4f28e0fdb8c1d48af9f503a2586.

danielroe avatar Apr 29 '24 09:04 danielroe

I believe this should be resolved in 19e3eaf99960b4f28e0fdb8c1d48af9f503a2586.

when i tested it recently it worked afaicr

thunfisch987 avatar Apr 29 '24 21:04 thunfisch987