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

[Bug]"enableGlobalCache" config not compatible with ESLint #965

Closed
1 task
jinliming2 opened this issue Feb 18, 2020 · 4 comments · Fixed by #2068
Closed
1 task

[Bug]"enableGlobalCache" config not compatible with ESLint #965

jinliming2 opened this issue Feb 18, 2020 · 4 comments · Fixed by #2068
Labels
bug Something isn't working external bug This issue highlights a bug in another project stale Issues that didn't get attention

Comments

@jinliming2
Copy link

  • I'd be willing to implement a fix

Describe the bug

Cause "Cannot read config file" error in ESLint when "enableGlobalCache: true".

To Reproduce

mkdir test

cd test

yarn init -y

yarn set version berry

yarn config set enableGlobalCache true

yarn add -D --exact eslint

cat > .eslintrc.js <<EOF
module.exports = {
  env: {
    browser: true,
    es6: true,
  },
  extends: [
    'eslint:recommended',
  ],
};
EOF

cat > test.js <<EOF
const a = 1;
debugger;
console.log(a);
EOF

yarn eslint .

Output

Error: Cannot read config file: /home/liming/.yarn/berry/cache/eslint-npm-6.8.0-d27045f313-2.zip/node_modules/eslint/conf/eslint-recommended.js
Error: Cannot find module '/home/liming/.yarn/berry/cache/eslint-npm-6.8.0-d27045f313-2.zip/node_modules/eslint/conf/eslint-recommended.js'
Require stack:
- /home/liming/.yarn/berry/cache/eslint-npm-6.8.0-d27045f313-2.zip/node_modules/eslint/lib/cli-engine/noop.js
Require stack:
- /home/liming/.yarn/berry/cache/eslint-npm-6.8.0-d27045f313-2.zip/node_modules/eslint/lib/cli-engine/noop.js
Referenced from: /dev/shm/test/.eslintrc.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:981:15)
    at Function.module_1.Module._resolveFilename (/dev/shm/test/.pnp.js:14911:54)
    at resolveFileName (/home/liming/.yarn/berry/cache/resolve-from-npm-4.0.0-f758ec21bf-2.zip/node_modules/resolve-from/index.js:29:39)
    at resolveFrom (/home/liming/.yarn/berry/cache/resolve-from-npm-4.0.0-f758ec21bf-2.zip/node_modules/resolve-from/index.js:43:9)
    at module.exports (/home/liming/.yarn/berry/cache/resolve-from-npm-4.0.0-f758ec21bf-2.zip/node_modules/resolve-from/index.js:46:41)
    at module.exports (/home/liming/.yarn/berry/cache/import-fresh-npm-3.2.1-b4f6711244-2.zip/node_modules/import-fresh/index.js:13:19)
    at loadJSConfigFile (/home/liming/.yarn/berry/cache/eslint-npm-6.8.0-d27045f313-2.zip/node_modules/eslint/lib/cli-engine/config-array-factory.js:201:16)
    at loadConfigFile (/home/liming/.yarn/berry/cache/eslint-npm-6.8.0-d27045f313-2.zip/node_modules/eslint/lib/cli-engine/config-array-factory.js:284:20)
    at ConfigArrayFactory._loadConfigData (/home/liming/.yarn/berry/cache/eslint-npm-6.8.0-d27045f313-2.zip/node_modules/eslint/lib/cli-engine/config-array-factory.js:496:13)
    at ConfigArrayFactory._loadExtendedBuiltInConfig (/home/liming/.yarn/berry/cache/eslint-npm-6.8.0-d27045f313-2.zip/node_modules/eslint/lib/cli-engine/config-array-factory.js:753:25)

Environment if relevant (please complete the following information):

  • OS: Linux
  • Node version: v12.16.0
  • Yarn version: 2.0.0-rc.29

Additional context

Works fine when "enableGlobalCache: false".

@Js-Brecht
Copy link
Contributor

Js-Brecht commented Feb 28, 2020

I have the same problem. I mainly notice it when using vscode-eslint, but is the same when running yarn lint

vscode-eslint output
[Info  - 11:24:52 AM] ESLint server stopped.
[Info  - 11:24:52 AM] ESLint server running in node v12.4.0
[Info  - 11:24:52 AM] ESLint server is running.
[Info  - 11:24:55 AM] ESLint library loaded from: D:\dev\source\gatsby\gatsby-plugin-ts-config\.vscode\pnpify\eslint\lib\api.js
(node:12848) UnhandledPromiseRejectionWarning: Error: Cannot read config file: D:\dev\source\gatsby\gatsby-plugin-ts-config\.yarn\$$virtual\@jtechsvcs-eslint-config-typescript-virtual-d0a2d39069\4\.yarncache\berry\cache\@jtechsvcs-eslint-config-typescript-npm-2.0.3-12e3f22086-2.zip\node_modules\@jtechsvcs\eslint-config-typescript\index.js
Error: Cannot find module 'D:\dev\source\gatsby\gatsby-plugin-ts-config\.yarn\$$virtual\@jtechsvcs-eslint-config-typescript-virtual-d0a2d39069\4\.yarncache\berry\cache\@jtechsvcs-eslint-config-typescript-npm-2.0.3-12e3f22086-2.zip\node_modules\@jtechsvcs\eslint-config-typescript\index.js'
Require stack:
- D:\dev\.yarncache\berry\cache\eslint-npm-6.8.0-d27045f313-2.zip\node_modules\eslint\lib\cli-engine\noop.js
Require stack:
- D:\dev\.yarncache\berry\cache\eslint-npm-6.8.0-d27045f313-2.zip\node_modules\eslint\lib\cli-engine\noop.js
Referenced from: D:\dev\source\gatsby\gatsby-plugin-ts-config\.eslintrc
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:627:15)
    at Function.module_1.Module._resolveFilename (D:\dev\source\gatsby\gatsby-plugin-ts-config\.pnp.js:29604:54)
    at resolveFileName (D:\dev\.yarncache\berry\cache\resolve-from-npm-4.0.0-f758ec21bf-2.zip\node_modules\resolve-from\index.js:29:39)
    at resolveFrom (D:\dev\.yarncache\berry\cache\resolve-from-npm-4.0.0-f758ec21bf-2.zip\node_modules\resolve-from\index.js:43:9)
    at module.exports (D:\dev\.yarncache\berry\cache\resolve-from-npm-4.0.0-f758ec21bf-2.zip\node_modules\resolve-from\index.js:46:41)
    at module.exports (D:\dev\.yarncache\berry\cache\import-fresh-npm-3.2.1-b4f6711244-2.zip\node_modules\import-fresh\index.js:13:19)
    at loadJSConfigFile (D:\dev\.yarncache\berry\cache\eslint-npm-6.8.0-d27045f313-2.zip\node_modules\eslint\lib\cli-engine\config-array-factory.js:201:16)
    at loadConfigFile (D:\dev\.yarncache\berry\cache\eslint-npm-6.8.0-d27045f313-2.zip\node_modules\eslint\lib\cli-engine\config-array-factory.js:284:20)
    at ConfigArrayFactory._loadConfigData (D:\dev\.yarncache\berry\cache\eslint-npm-6.8.0-d27045f313-2.zip\node_modules\eslint\lib\cli-engine\config-array-factory.js:496:13)
    at ConfigArrayFactory._loadExtendedShareableConfig (D:\dev\.yarncache\berry\cache\eslint-npm-6.8.0-d27045f313-2.zip\node_modules\eslint\lib\cli-engine\config-array-factory.js:832:21)
(node:12848) UnhandledPromiseRejectionWarning: Error: Cannot read config file: D:\dev\source\gatsby\gatsby-plugin-ts-config\.yarn\$$virtual\@jtechsvcs-eslint-config-typescript-virtual-d0a2d39069\4\.yarncache\berry\cache\@jtechsvcs-eslint-config-typescript-npm-2.0.3-12e3f22086-2.zip\node_modules\@jtechsvcs\eslint-config-typescript\index.js
Error: Cannot find module 'D:\dev\source\gatsby\gatsby-plugin-ts-config\.yarn\$$virtual\@jtechsvcs-eslint-config-typescript-virtual-d0a2d39069\4\.yarncache\berry\cache\@jtechsvcs-eslint-config-typescript-npm-2.0.3-12e3f22086-2.zip\node_modules\@jtechsvcs\eslint-config-typescript\index.js'
Require stack:
- D:\dev\.yarncache\berry\cache\eslint-npm-6.8.0-d27045f313-2.zip\node_modules\eslint\lib\cli-engine\noop.js
Require stack:
- D:\dev\.yarncache\berry\cache\eslint-npm-6.8.0-d27045f313-2.zip\node_modules\eslint\lib\cli-engine\noop.js
Referenced from: D:\dev\source\gatsby\gatsby-plugin-ts-config\.eslintrc
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:627:15)
    at Function.module_1.Module._resolveFilename (D:\dev\source\gatsby\gatsby-plugin-ts-config\.pnp.js:29604:54)
    at resolveFileName (D:\dev\.yarncache\berry\cache\resolve-from-npm-4.0.0-f758ec21bf-2.zip\node_modules\resolve-from\index.js:29:39)
    at resolveFrom (D:\dev\.yarncache\berry\cache\resolve-from-npm-4.0.0-f758ec21bf-2.zip\node_modules\resolve-from\index.js:43:9)
    at module.exports (D:\dev\.yarncache\berry\cache\resolve-from-npm-4.0.0-f758ec21bf-2.zip\node_modules\resolve-from\index.js:46:41)
    at module.exports (D:\dev\.yarncache\berry\cache\import-fresh-npm-3.2.1-b4f6711244-2.zip\node_modules\import-fresh\index.js:13:19)
    at loadJSConfigFile (D:\dev\.yarncache\berry\cache\eslint-npm-6.8.0-d27045f313-2.zip\node_modules\eslint\lib\cli-engine\config-array-factory.js:201:16)
    at loadConfigFile (D:\dev\.yarncache\berry\cache\eslint-npm-6.8.0-d27045f313-2.zip\node_modules\eslint\lib\cli-engine\config-array-factory.js:284:20)
    at ConfigArrayFactory._loadConfigData (D:\dev\.yarncache\berry\cache\eslint-npm-6.8.0-d27045f313-2.zip\node_modules\eslint\lib\cli-engine\config-array-factory.js:496:13)
    at ConfigArrayFactory._loadExtendedShareableConfig (D:\dev\.yarncache\berry\cache\eslint-npm-6.8.0-d27045f313-2.zip\node_modules\eslint\lib\cli-engine\config-array-factory.js:832:21)
(node:12848) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:12848) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:12848) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:12848) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[Error - 11:24:55 AM] Cannot read config file: D:\dev\source\gatsby\gatsby-plugin-ts-config\.yarn\$$virtual\@jtechsvcs-eslint-config-typescript-virtual-d0a2d39069\4\.yarncache\berry\cache\@jtechsvcs-eslint-config-typescript-npm-2.0.3-12e3f22086-2.zip\node_modules\@jtechsvcs\eslint-config-typescript\index.js Error: Cannot find module 'D:\dev\source\gatsby\gatsby-plugin-ts-config\.yarn\$$virtual\@jtechsvcs-eslint-config-typescript-virtual-d0a2d39069\4\.yarncache\berry\cache\@jtechsvcs-eslint-config-typescript-npm-2.0.3-12e3f22086-2.zip\node_modules\@jtechsvcs\eslint-config-typescript\index.js' Require stack: - D:\dev\.yarncache\berry\cache\eslint-npm-6.8.0-d27045f313-2.zip\node_modules\eslint\lib\cli-engine\noop.js Require stack: - D:\dev\.yarncache\berry\cache\eslint-npm-6.8.0-d27045f313-2.zip\node_modules\eslint\lib\cli-engine\noop.js Referenced from: D:\dev\source\gatsby\gatsby-plugin-ts-config\.eslintrc

I have enableGlobalCache turned on in $HOME/.yarnrc.yml, and the globalFolder defined as /D:/dev/.yarncache/berry. Seems to work okay for most things; not for this.

You can see it in action at Js-Brecht/gatsby-plugin-ts-config#yarn-pnp-setup.

@yarnbot
Copy link
Collaborator

yarnbot commented Jun 9, 2020

Hi! 👋

This issue looks stale, and doesn't feature the reproducible label - which implies that you didn't provide a working reproduction using Sherlock. As a result, it'll be closed in a few days unless a maintainer explicitly vouches for it or you edit your first post to include a formal reproduction (you can use the playground for that).

Note that we require Sherlock reproductions for long-lived issues (rather than standalone git repositories or similar) because we're a small team. Sherlock gives us the ability to check which bugs are still affecting the master branch at any given point, and decreases the amount of code we need to run on our own machines (thus leading to faster bug resolution faster). It helps us help you! 😃

If you absolutely cannot reproduce a bug on Sherlock (for example because it's a Windows-only issue), a maintainer will have to manually add the upholded label.

@yarnbot yarnbot added the stale Issues that didn't get attention label Jun 9, 2020
@IT-CASADO
Copy link

Same for me on a Windows system.

  • OS: Windows
  • Node version: v12.17.0
  • Yarn version: 2.0.0-rc.33

@merceyz merceyz added the external bug This issue highlights a bug in another project label Jul 12, 2020
@merceyz
Copy link
Member

merceyz commented Jul 12, 2020

Duplicate of #706

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working external bug This issue highlights a bug in another project stale Issues that didn't get attention
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants