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

Yarn PnP Compatibility #5117

Closed
DanielRuf opened this Issue Sep 27, 2018 · 9 comments

Comments

Projects
None yet
4 participants
@DanielRuf

DanielRuf commented Sep 27, 2018

Is this a bug report?

Yes

Clone DanielRuf/coding-coach, checkout the feature/yarn-pnp branch and install with Yarn nightly and run yarn start.

Module build failed: Error: Failed to load plugin flowtype: Package "eslint@4.10.0" (via "/Users/druf/Library/Caches/Yarn/v3/npm-eslint-4.10.0-f25d0d7955c81968c2309aa5c9a229e045176bb7/node_modules/eslint/lib/config/plugins.js") is trying to require the package "eslint-plugin-flowtype" (via "eslint-plugin-flowtype") without it being listed in its dependencies (ajv, babel-code-frame, chalk, concat-stream, cross-spawn, debug, doctrine, eslint-scope, espree, esquery, estraverse, esutils, file-entry-cache, functional-red-black-tree, glob, globals, ignore, imurmurhash, inquirer, is-resolvable, js-yaml, json-stable-stringify, levn, lodash, minimatch, mkdirp, natural-compare, optionator, path-is-inside, pluralize, progress, require-uncached, semver, strip-ansi, strip-json-comments, table, text-table, eslint)
Referenced from: 
    at Array.forEach (<anonymous>)
    at Array.reduceRight (<anonymous>)

Did you try recovering your dependencies?

Not needed as this is a clean install.

Which terms did you search for in User Guide?

Environment

The project uses react-scripts@1.1.5.

(paste the output of the command here)

Steps to Reproduce

Clone DanielRuf/coding-coach, checkout the feature/yarn-pnp branch and install with Yarn nightly and run yarn start.

  1. Clone DanielRuf/coding-coach
  2. checkout the feature/yarn-pnp branch
  3. install Yarn nightly
  4. run yarn && yarn start

Expected Behavior

(Write what you thought would happen.)

It should run without any errors.

Actual Behavior

I've got

Module build failed: Error: Failed to load plugin flowtype: Package "eslint@4.10.0" (via "/Users/druf/Library/Caches/Yarn/v3/npm-eslint-4.10.0-f25d0d7955c81968c2309aa5c9a229e045176bb7/node_modules/eslint/lib/config/plugins.js") is trying to require the package "eslint-plugin-flowtype" (via "eslint-plugin-flowtype") without it being listed in its dependencies (ajv, babel-code-frame, chalk, concat-stream, cross-spawn, debug, doctrine, eslint-scope, espree, esquery, estraverse, esutils, file-entry-cache, functional-red-black-tree, glob, globals, ignore, imurmurhash, inquirer, is-resolvable, js-yaml, json-stable-stringify, levn, lodash, minimatch, mkdirp, natural-compare, optionator, path-is-inside, pluralize, progress, require-uncached, semver, strip-ansi, strip-json-comments, table, text-table, eslint)
Referenced from: 
    at Array.forEach (<anonymous>)
    at Array.reduceRight (<anonymous>)

Reproducible Demo

(Paste the link to an example project and exact instructions to reproduce the issue.)

@DanielRuf

This comment has been minimized.

DanielRuf commented Sep 27, 2018

It's similar with @next:

Error: Package "webpack-dev-middleware@3.4.0" (via "/Users/druf/Library/Caches/Yarn/v3/npm-webpack-dev-middleware-3.4.0-1132fecc9026fd90f0ecedac5cbff75d1fb45890/node_modules/webpack-dev-middleware/lib/fs.js") is trying to require the package "webpack" (via "webpack/lib/node/NodeOutputFileSystem") without it being listed in its dependencies (memory-fs, mime, range-parser, webpack-log, webpack-dev-middleware)
    at makeError (/Users/druf/projects/coding-coach/.pnp.js:47:17)
    at Object.resolveToUnqualified (/Users/druf/projects/coding-coach/.pnp.js:20767:17)
    at Object.resolveRequest (/Users/druf/projects/coding-coach/.pnp.js:20838:31)
    at Function.Module._resolveFilename (/Users/druf/projects/coding-coach/.pnp.js:20990:32)
    at Function.Module._load (/Users/druf/projects/coding-coach/.pnp.js:20936:31)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/Users/druf/Library/Caches/Yarn/v3/npm-webpack-dev-middleware-3.4.0-1132fecc9026fd90f0ecedac5cbff75d1fb45890/node_modules/webpack-dev-middleware/lib/fs.js:7:30)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
@DanielRuf

This comment has been minimized.

DanielRuf commented Sep 27, 2018

After running yarn add webpack --dev:

Error: Package "react-dev-utils@6.0.0" (via "/Users/druf/Library/Caches/Yarn/v3/npm-react-dev-utils-6.0.0-e254f94a29ba0a63561225bbccbdec5f2ec52ade/node_modules/react-dev-utils/getCSSModuleLocalIdent.js") is trying to require the package "loader-utils" (via "loader-utils") without it being listed in its dependencies (@babel/code-frame, address, browserslist, chalk, cross-spawn, detect-port-alt, escape-string-regexp, filesize, global-modules, gzip-size, inquirer, is-root, opn, pkg-up, react-error-overlay, recursive-readdir, shell-quote, sockjs-client, strip-ansi, text-table, react-dev-utils)
    at makeError (/Users/druf/projects/coding-coach/.pnp.js:47:17)
    at Object.resolveToUnqualified (/Users/druf/projects/coding-coach/.pnp.js:20995:17)
    at Object.resolveRequest (/Users/druf/projects/coding-coach/.pnp.js:21066:31)
    at Function.Module._resolveFilename (/Users/druf/projects/coding-coach/.pnp.js:21218:32)
    at Function.Module._load (/Users/druf/projects/coding-coach/.pnp.js:21164:31)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/Users/druf/Library/Caches/Yarn/v3/npm-react-dev-utils-6.0.0-e254f94a29ba0a63561225bbccbdec5f2ec52ade/node_modules/react-dev-utils/getCSSModuleLocalIdent.js:10:21)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@DanielRuf

This comment has been minimized.

DanielRuf commented Sep 27, 2018

After adding a browserlist-config to package.json:

Error: Cannot find module 'loader-runner'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/Users/druf/Library/Caches/Yarn/v3/npm-thread-loader-1.2.0-35dedb23cf294afbbce6c45c1339b950ed17e7a4/node_modules/thread-loader/dist/worker.js:11:21)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
internal/modules/cjs/loader.js:583
    throw err;
    ^
@DanielRuf

This comment has been minimized.

DanielRuf commented Sep 27, 2018

yarn why thread-loader
yarn why v1.12.0-20180926.1157
[1/4] 🤔  Why do we have the module "thread-loader"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "react-scripts#thread-loader@1.2.0"
info Reasons this module exists
   - "react-scripts" depends on it
   - in the nohoist list null
✨  Done in 1.42s.
@gaearon

This comment has been minimized.

Member

gaearon commented Sep 27, 2018

@arcanis

This comment has been minimized.

Member

arcanis commented Sep 27, 2018

Hey @DanielRuf! I think this issue is related to eslint/eslint#10125 (and more generally the thread that I started at eslint/eslint#10643 (comment))

cc @not-an-aardvark

@gaearon

This comment has been minimized.

Member

gaearon commented Sep 27, 2018

@arcanis Can I ask you to look into non-ESLint related issues in the meantime? Seems like there are others with thread-loader and something else in this thread. It's related to our 2.x release where we merged a bunch of stuff into master. You can try with #5103.

@gaearon gaearon changed the title from issue with Yarn PnP and eslint 4 to Yarn PnP Compatibility Sep 27, 2018

@arcanis

This comment has been minimized.

Member

arcanis commented Sep 27, 2018

Looking 👍

@arcanis

This comment has been minimized.

Member

arcanis commented Sep 27, 2018

  • A Yarn bug was preventing webpack-dev-middleware to access webpack - will be fixed with yarnpkg/yarn#6443

  • A dependency was missing from react-dev-utils - fixed with #5134

  • The pnp-webpack-plugin was missing - will be fixed with #5136

  • The thread-loader package doesnt forward process.execArgv to the spawned threads, preventing them from loading their dependencies since the hook isn't setup in their environment - will be fixed with #5136

@Timer Timer added this to the 2.x milestone Sep 27, 2018

@gaearon gaearon closed this in #5136 Oct 1, 2018

@Timer Timer modified the milestones: 2.x, 2.0 Oct 1, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment