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.

Fix "TypeError: opts.node.rangeBy is not a function" with PostCSS 8.4.4

See original GitHub issue

What steps are needed to reproduce the bug?

folder structure: package.json .stylelintrc.json styles.scss (empty file)

package.json:

{
  "name": "untitled2",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "lint": "npx stylelint '**/*.scss'"
  },
  "devDependencies": {
    "stylelint": "^14.1.0",
    "stylelint-config-standard-scss": "^3.0.0"
  }
}

npm i npm run lint

What Stylelint configuration is needed to reproduce the bug?

{
  "extends": "stylelint-config-standard-scss"
}

How did you run Stylelint?

npx stylelint ‘**/*.scss’

Which version of Stylelint are you using?

^14.1.0

What did you expect to happen?

I expect stylelint to show list of errors.

What actually happened?

TypeError: opts.node.rangeBy is not a function
at new Warning (node_modules/postcss/lib/warning.js:9:29)
at Result.warn (node_modules/postcss/lib/result.js:26:19)
at report (node_modules/stylelint/lib/utils/report.js:103:9)
at node_modules/stylelint/lib/rules/no-empty-source/index.js:28:3
at node_modules/stylelint/lib/lintPostcssResult.js:112:8
at Array.map (<anonymous>)
at lintPostcssResult (node_modules/stylelint/lib/lintPostcssResult.js:103:18)
at lintSource (node_modules/stylelint/lib/lintSource.js:88:8)
at async node_modules/stylelint/lib/standalone.js:218:27
at async Promise.all (index 0)

Process finished with exit code 1

The problem is in this line

image

Does the bug relate to non-standard syntax?

No

Proposal to fix the bug

Works correctly with exactly 8.3.11 version of postcss. I compared the code in warning.js between these versions of postcss (8.3.11 and 8.4.4), they changed the method name. 😦

Proposal: change dependencies of stylelint to use exactly 8.3.11 version.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:25
  • Comments:67 (36 by maintainers)

github_iconTop GitHub Comments

12reactions
lreglacommented, Dec 9, 2021

Also started with a fresh install of stylelint@14.1.0 and stylelint-config-standard-scss@3.0.0. Ran into the same error described above. Installed postcss@8.4.4 as @BroFox86 did, and the error is gone.

5reactions
aicommented, Aug 6, 2022

Now let’s bump Stylelint with the latest PostCSS version and ask every user just to update stylelint in their package.json.

Thanks to @JounQin and @snebjorn for solving this very complex bug.

Read more comments on GitHub >

github_iconTop Results From Across the Web

opts.node.rangeBy is not a function" with PostCSS 8.4.4
Fix "TypeError: opts.node.rangeBy is not a function" with PostCSS 8.4.4.
Read more >
PostCSS API
If you create a node manually (e.g., with postcss.decl() ), that node will not have a source property and will be absent from...
Read more >
postcss/postcss - Gitter
A lot of TypeError: node.getIterator is not a function in tests after update postcss in css-loader, somebody say ... I am a bottom...
Read more >
Error: PostCSS plugin tailwindcss requires PostCSS 8
I tried everything and was still having TypeError: getProcessedPlugins is not a function error. What fixed the issue ...
Read more >
postcss@8.4.20 - jsDocs.io
If it's followed in the CSS by a {} block, this node will have a nodes property representing its children.
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