webhintio / hint

💡 A hinting engine for the web
https://webhint.io/
Apache License 2.0
3.62k stars 670 forks source link

[Bug] Doesn't support Yarn v2 with PnP. #4000

Open yoannmoinet opened 4 years ago

yoannmoinet commented 4 years ago

🐛 Bug report

Description

We're using Yarn v2 with PnP enabled. Running yarn hint <path to dist folder> outputs this:

The following packages are missing:
    hint-compat-api/css, hint-compat-api/html
There are packages from your .hintrc file not installed or with an incompatible version. Do you want us to try to install/update them? (Y/n)

Answering Y will trigger this error:

Installing packages...
npm ERR! code ENOLOCAL
npm ERR! Could not install from "@hint/hint-compat-api/css" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR!     <path to log file>

There was a problem installing packages.
Please try executing:
    sudo npm install --global @hint/hint-compat-api/css @hint/hint-compat-api/html
            manually to install all the packages.

So we installed manually

yarn add -D @hint/hint-compat-api @hint/formatter-html @hint/formatter-summary @hint/connector-local

But the error persists.

Environment

webhint configuration

webhint’s configuration ```json { "connector": "local", "formatters": [ "html", "summary" ], "browserslist": [ "last 2 versions", "IE 11" ], "hints": { "compat-api/css": "error", "compat-api/html": "error" }, "hintsTimeout": 10000 } ```

Debug output

Please include the raw output generated by webhint, or if possible, the raw output from running webhint in debug mode: hint --debug <URL>.

webhint’s raw output ```text The following packages are missing: hint-compat-api/css, hint-compat-api/html There are packages from your .hintrc file not installed or with an incompatible version. Do you want us to try to install/update them? (Y/n) ``` and ```bash Installing packages... npm ERR! code ENOLOCAL npm ERR! Could not install from "@hint/hint-compat-api/css" as it does not contain a package.json file. npm ERR! A complete log of this run can be found in: npm ERR! There was a problem installing packages. Please try executing: sudo npm install --global @hint/hint-compat-api/css @hint/hint-compat-api/html manually to install all the packages. ```
molant commented 4 years ago

Hi @yoannmoinet

Seems like yarn2 is not downloading the packages the same way npx does. I haven't tried yarn 2 myself but if their goal is to have parity I would raise this issue with them as I doubt we would be the only project running into this.

Unfortunately the team does not have time to look into this at the moment but if you find out how to make it work please submit a PR!

hxlnt commented 4 years ago

This change will require some changes to webhint's resource loader.