Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TypeError [ERR_INVALID_URL_SCHEME] in function-no-unknown #5918

Closed
kliehm opened this issue Feb 14, 2022 · 14 comments · Fixed by #5916
Closed

Fix TypeError [ERR_INVALID_URL_SCHEME] in function-no-unknown #5918

kliehm opened this issue Feb 14, 2022 · 14 comments · Fixed by #5916
Labels
status: wip is being worked on by someone type: bug a problem with a feature or rule

Comments

@kliehm
Copy link

kliehm commented Feb 14, 2022

What steps are needed to reproduce the bug?

I think there's a bug in 14.5.0. If I use

@use "sass:color"
@use "~mypackage"

Then I get an error

TypeError [ERR_INVALID_URL_SCHEME]: The URL must be of scheme file
    at Object.openSync (fs.js:490:10)
    at Object.readFileSync (fs.js:394:35)
    at \node_modules\stylelint\lib\rules\function-no-unknown\index.js:48:39  

What Stylelint configuration is needed to reproduce the bug?

any

How did you run Stylelint?

stylelint './src/**/*.scss' --fix

Which version of Stylelint are you using?

14.5.0

What did you expect to happen?

No script error

What actually happened?

TypeError [ERR_INVALID_URL_SCHEME]: The URL must be of scheme file
    at Object.openSync (fs.js:490:10)
    at Object.readFileSync (fs.js:394:35)
    at \node_modules\stylelint\lib\rules\function-no-unknown\index.js:48:39  

Does the bug relate to non-standard syntax?

No response

Proposal to fix the bug

Compare with 14.4.0, it only occurs in 14.5.0

@ybiquitous
Copy link
Member

@kliehm Thanks for the report and for using the template.

Maybe, PR #5916 should fix the error since URL is no longer used.

@ybiquitous ybiquitous added status: wip is being worked on by someone type: bug a problem with a feature or rule labels Feb 14, 2022
@jeddy3 jeddy3 changed the title file: protocol not working for @use of packages Fix TypeError [ERR_INVALID_URL_SCHEME] in function-no-unknown Feb 14, 2022
@danielweck
Copy link

FYI I am experiencing the same CI failure.

@danielweck
Copy link

Error, only on Windows (via GitHub Actions CI builds):

Stylelint 14.5.0

TypeError [ERR_INVALID_URL_SCHEME]: The URL must be of scheme file
    at Object.openSync (node:fs:577:10)
    at Object.readFileSync (node:fs:453:35)
    at D:\a\project\node_modules\stylelint\lib\rules\function-no-unknown\index.js:48:39
    at D:\a\project\node_modules\stylelint\lib\lintPostcssResult.js:113:8
    at Array.map (<anonymous>)
    at lintPostcssResult (D:\a\project\node_modules\stylelint\lib\lintPostcssResult.js:104:18)
    at lintSource (D:\a\project\node_modules\stylelint\lib\lintSource.js:91:8)
    at async D:\a\project\node_modules\stylelint\lib\standalone.js:227:27
    at async Promise.all (index 0)
    at async standalone (D:\a\project\node_modules\stylelint\lib\standalone.js:266:22)
Error: Process completed with exit code 1.

Configuration:

{
    "extends": "stylelint-config-standard",
    "rules": {
        "declaration-block-no-redundant-longhand-properties": null,
        "shorthand-property-no-redundant-values": null,
        "selector-class-pattern": null,
        "custom-property-pattern": null,
        "selector-id-pattern": null,
        "keyframes-name-pattern": null,
        "property-no-vendor-prefix": null,
        "value-no-vendor-prefix": null,
        "number-max-precision": null,
        "color-function-notation": null,
        "alpha-value-notation": null,
        "string-quotes": null,
        "selector-attribute-quotes": null,
        "function-url-quotes": null,
        "font-family-name-quotes": null,
        "no-descending-specificity": null,
        "at-rule-no-unknown": [
            true,
            {
                "ignoreAtRules": ["define-mixin", "mixin", "include"]
            }
        ],
        "selector-pseudo-class-no-unknown": [
            true,
            {
                "ignorePseudoClasses": ["global"]
            }
        ]
    }
}

@danielweck
Copy link

danielweck commented Feb 15, 2022

The only notable change in my package-lock.json is css-functions-list, see changelog:
https://github.com/niksy/css-functions-list/releases/tag/v3.0.1

Use fileURLToPath for location resolve

niksy/css-functions-list@153211e

@danielweck
Copy link

danielweck commented Feb 15, 2022

Ah yes, I see @niksy the author of css-functions-list has already chimed in here, in the PR:
#5916 (comment)
👍

@BePo65
Copy link

BePo65 commented Feb 16, 2022

Just a short question: should the problem now be solved (without a new release)?

In my program I removed the package-lock,json and the node_modules folder and reinstalled all packages (including stylelint-config-standard@25.0.0), but the error ("TypeError [ERR_INVALID_URL_SCHEME]: The URL must be of scheme file") is still there.

In my package-lock.json I see "css-functions-list@3.0.1" (so the correct version of "css-functions-list" seems to be installed).

Is there something i must do besides reinstalling my packages?

@kliehm
Copy link
Author

kliehm commented Feb 16, 2022

Is there something i must do besides reinstalling my packages?

I see it's scheduled for release 14.5.1, which isn't available on github yet. In the meantime you can set "function-no-unknown": null in your .stylelintrc.js file to avoid the error.

@ybiquitous
Copy link
Member

@BePo65 If you enable function-no-unknown and there are no errors, the update of css-functions-list to 3.0.1 just should be good. 👍🏼

@danielweck
Copy link

I have updaated all my NPM packages, unfortunately the regression bug remains. In fact, I believe the bug was introduced by css-functions-list version 3.0.1, see my original report (3 comments in a row):

#5918 (comment)

...let me try to pin css-functions-list to version 3.0.0, just to see what happens.

@ybiquitous
Copy link
Member

@danielweck Have you tried stylelint@14.5.1?

@danielweck
Copy link

Have you tried stylelint@14.5.1?

Ah, I see it has just been published ... will try now :)

https://www.npmjs.com/package/stylelint/v/14.5.1

@danielweck
Copy link

...let me try to pin css-functions-list to version 3.0.0, just to see what happens.

Confirmed that this works. However, I am going to try https://www.npmjs.com/package/stylelint/v/14.5.1 now.

@danielweck
Copy link

Have you tried stylelint@14.5.1?

Ah, I see it has just been published ... will try now :)

https://www.npmjs.com/package/stylelint/v/14.5.1

Yep, all fixed now :)
Thanks 👍

@niksy
Copy link

niksy commented Feb 16, 2022

Thanks everyone for bug report, glad that we could get this resolved, and sorry for this little hiccup!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: wip is being worked on by someone type: bug a problem with a feature or rule
Development

Successfully merging a pull request may close this issue.

5 participants