Skip to content

Error thrown on compiling using a sourcemap and autoprefix in Node v14 #3646

Closed
@coreyoss

Description

@coreyoss

Hello,

I recently upgraded to Node v4.17.5 and it seems a newly added exception there is breaking my Less build.

I'm using less v4.1.1 and less-plugin-autoprefix v2.0.0. To recreate the issue I've -

  1. Installed the above packages globally
  2. Created a less file (test.less) with the following content -
p {
    color: blue;
}
  1. On the command line, run -
    lessc test.less test.css --source-map=test.css.map --autoprefix='defaults'

On running this, I get the errors -

internal/fs/utils.js:793
  throw new ERR_INVALID_ARG_TYPE(
  ^

TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of SourceMapGenerator
    at writeFile (fs.js:1487:5)
    at go$writeFile (/usr/lib/node_modules/less/node_modules/graceful-fs/graceful-fs.js:138:14)
    at Object.writeFile (/usr/lib/node_modules/less/node_modules/graceful-fs/graceful-fs.js:135:12)
    at writeSourceMap (/usr/lib/node_modules/less/bin/lessc:183:10)
    at writeSourceMapIfNeeded (/usr/lib/node_modules/less/bin/lessc:207:7)
    at /usr/lib/node_modules/less/bin/lessc:299:11
    at /usr/lib/node_modules/less/bin/lessc:237:11
    at /usr/lib/node_modules/less/node_modules/graceful-fs/graceful-fs.js:143:16
    at /usr/lib/node_modules/less/node_modules/graceful-fs/graceful-fs.js:61:14
    at FSReqCallback.oncomplete (fs.js:180:23) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Interestingly, I don't get the error if I exclude the sourcemap or the autoprefix. Eg. lessc test.less test.css --source-map=test.css.map works and so does lessc test.less test.css --autoprefix='defaults'.

I downgraded to Node v12.22.5 and this works fine.

Any help in resolving this would be appreciated!

Thanks,
Corey

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions