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: [files].flat is not a function

See original GitHub issue

What steps are needed to reproduce the bug?

Run linting inside a docker container using sh and a script.

Linting works fine locally i.e. outside of the docker container. The script runs other linting, using “ng lint”. We have no issues running multiple libraries using docker containers in our CI/CD pipeline.

What Stylelint configuration is needed to reproduce the bug?

{ “extends”: [“stylelint-config-standard”], “rules”: { “max-line-length”: 150 } }

How did you run Stylelint?

npx stylelint ‘/*.css’ and stylelint '/*.css’

Which version of Stylelint are you using?

14.9.1

What did you expect to happen?

No problems to be reported

What actually happened?

When linting is running inside a docker container, it exits with this error code:

TypeError: [files].flat is not a function at standalone (/usr/src/app/node_modules/stylelint/lib/standalone.js:160:25) at module.exports (/usr/src/app/node_modules/stylelint/lib/cli.js:484:9) at Object.<anonymous> (/usr/src/app/node_modules/stylelint/bin/stylelint.js:8:22) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions…js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Function.Module.runMain (internal/modules/cjs/loader.js:831:12) at findNodeScript.then.existing (/usr/local/lib/node_modules/npm/node_modules/libnpx/index.js:268:14)

Does the bug relate to non-standard syntax?

No response

Proposal to fix the bug

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
RKECcommented, Jul 27, 2022

Node version was the issue. Currently using node image cypress/base:14.15.0, which has fixed the problem

0reactions
JounQincommented, Jul 26, 2022

node:10.20.1-alpine is definely not supported, sorry.

but tried with 14-alpine and 14.20-alpine and having same issue

Please provide a minimal but runnable reproduction next time, close for now.

If you provide the reproduction correctly, I’ll reopen it, thanks for your understanding.

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - .flat() is not a function, what's wrong?
As a function, the depth variable specifies how deep the input array structure should be flattened (defaults to 1; use Infinity to go...
Read more >
How to Fix "flat is not a function" JavaScript Error?
It could be that you're calling the Array.prototype.flat() method on an object that is not an array. This could happen, for example, if...
Read more >
TypeError: flat is not a function in JavaScript
To solve the "flat is not a function" error, make sure to only call the flat() method on arrays and in browsers that...
Read more >
"flat is not a function" error · Issue #57 · digitalbazaar/vc-js
Hello, I'm trying to verify a presentation but get this error in the console. I'm sure that I have some problems in my...
Read more >
TypeError: fields.flat is not a function - Code Help - Discord
Hi, I am working on a bot named Cerberus, everything in my code has been debugged properly, and I just transferred from another...
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