An error is reported due to a specific CSS:opts.node.rangeBy is not a function
See original GitHub issueWhat steps are needed to reproduce the bug?
When the code written with SCSS file contains font family, an error will be reported. as follows
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
}
The error information is as follows:
$ stylelint **/*.scss
TypeError: opts.node.rangeBy is not a function
at new Warning (/Users/ranhe/servyou/dpl-pro-javascript-template/node_modules/stylelint/node_modules/postcss/lib/warning.js:9:29)
at Result.warn (/Users/ranhe/servyou/dpl-pro-javascript-template/node_modules/stylelint/node_modules/postcss/lib/result.js:26:19)
at report (/Users/ranhe/servyou/dpl-pro-javascript-template/node_modules/stylelint/lib/utils/report.js:103:9)
at complain (/Users/ranhe/servyou/dpl-pro-javascript-template/node_modules/stylelint/lib/rules/max-line-length/index.js:80:4)
at checkNewline (/Users/ranhe/servyou/dpl-pro-javascript-template/node_modules/stylelint/lib/rules/max-line-length/index.js:187:11)
at /Users/ranhe/servyou/dpl-pro-javascript-template/node_modules/stylelint/lib/rules/max-line-length/index.js:73:4
at handleMatch (/Users/ranhe/servyou/dpl-pro-javascript-template/node_modules/style-search/index.js:201:5)
at module.exports (/Users/ranhe/servyou/dpl-pro-javascript-template/node_modules/style-search/index.js:189:5)
at /Users/ranhe/servyou/dpl-pro-javascript-template/node_modules/stylelint/lib/rules/max-line-length/index.js:72:3
at /Users/ranhe/servyou/dpl-pro-javascript-template/node_modules/stylelint/lib/lintPostcssResult.js:112:8
error Command failed with exit code 1.
What Stylelint configuration is needed to reproduce the bug?
{
"extends": "stylelint-config-standard-scss",
"overrides": [
{
"files": "**/*.scss",
"rules": {
"no-empty-source": null,
"selector-list-comma-newline-after": null
}
}
]
}
How did you run Stylelint?
npx stylelint **/*.scss
Which version of Stylelint are you using?
14.0.1
What did you expect to happen?
No error reported
What actually happened?
$ stylelint **/*.scss
TypeError: opts.node.rangeBy is not a function
at new Warning (/Users/ranhe/servyou/dpl-pro-javascript-template/node_modules/stylelint/node_modules/postcss/lib/warning.js:9:29)
at Result.warn (/Users/ranhe/servyou/dpl-pro-javascript-template/node_modules/stylelint/node_modules/postcss/lib/result.js:26:19)
at report (/Users/ranhe/servyou/dpl-pro-javascript-template/node_modules/stylelint/lib/utils/report.js:103:9)
at complain (/Users/ranhe/servyou/dpl-pro-javascript-template/node_modules/stylelint/lib/rules/max-line-length/index.js:80:4)
at checkNewline (/Users/ranhe/servyou/dpl-pro-javascript-template/node_modules/stylelint/lib/rules/max-line-length/index.js:187:11)
at /Users/ranhe/servyou/dpl-pro-javascript-template/node_modules/stylelint/lib/rules/max-line-length/index.js:73:4
at handleMatch (/Users/ranhe/servyou/dpl-pro-javascript-template/node_modules/style-search/index.js:201:5)
at module.exports (/Users/ranhe/servyou/dpl-pro-javascript-template/node_modules/style-search/index.js:189:5)
at /Users/ranhe/servyou/dpl-pro-javascript-template/node_modules/stylelint/lib/rules/max-line-length/index.js:72:3
at /Users/ranhe/servyou/dpl-pro-javascript-template/node_modules/stylelint/lib/lintPostcssResult.js:112:8
error Command failed with exit code 1.
Does the bug relate to non-standard syntax?
SCSS
Proposal to fix the bug
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:9 (1 by maintainers)
Top Results From Across the Web
opts.node.rangeBy is not a function" with PostCSS 8.4.4 ...
I expect stylelint to show list of errors. What actually happened? TypeError: opts.node.rangeBy is not a function at new Warning (node_modules/ ...
Read more >Migrating to 14.0.0 - Stylelint
It configures the built-in rules for SCSS, and includes the postcss-scss syntax and stylelint-scss plugin (a collection of rules specific to SCSS).
Read more >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 >NodeJs : TypeError: require(...) is not a function - Stack Overflow
For me, when I do Immediately invoked function, I need to put ; at the end of require() . Error: const fs =...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There are multiple postcss versions in the project. Among them, the postcss that stylelint depends on is the latest version, and the versions since other libraries in the project are lower versions, resulting in node_ Modules contains multiple postcss codes
In my case following the steps fixed the problem (as suggested by @hewenguang ).
npm ls postcss
(that show me multiple versions of postcss)npm i postcss@8.2.15
(and install one in specific)