yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.43k stars 2.72k forks source link

Yarn start error with PNP #7073

Closed Mohamed-Ghanem closed 3 years ago

Mohamed-Ghanem commented 5 years ago

Do you want to request a feature or report a bug? Reporting a bug. Trying to make an existing project run with pnp instead of node modules.

What is the current behavior? Yarn start throws and error and does not start the project.

If the current behavior is a bug, please provide the steps to reproduce.

  1. Upgrade yarn to 1.13.0
  2. Add this to package.json "installConfig": { "pnp": true }
  3. Delete node_modules folder
  4. Run this command yarn install
  5. Run this command yarn start

This is the output in console

...> yarn start
yarn run v1.13.0
$ react-app-rewired --max_old_space_size=4096 start
/...[path to project].../.pnp.js:22981
    throw firstError;
    ^

Error: Package "postcss-rtl@1.3.3" (via "/Users/[Username]/Library/Caches/Yarn/v4/npm-postcss-rtl-1.3.3-9ded22ba783cce5516640072f3cee0d28b746eaf/node_modules/postcss-rtl/lib/index.js") is trying to require the package "postcss" (via "postcss") without it being listed in its dependencies (rtlcss, postcss-rtl)
    at makeError (/...[path to project].../.pnp.js:55:17)
    at Object.resolveToUnqualified (/...[path to project].../.pnp.js:22719:17)
    at Object.resolveRequest (/...[path to project].../.pnp.js:22790:31)
    at Function.Module._resolveFilename (/...[path to project].../.pnp.js:22972:30)
    at Function.Module._load (/...[path to project].../.pnp.js:22888:31)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/[Username]/Library/Caches/Yarn/v4/npm-postcss-rtl-1.3.3-9ded22ba783cce5516640072f3cee0d28b746eaf/node_modules/postcss-rtl/lib/index.js:5:15)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

What is the expected behavior? Run normaly

Please mention your node.js, yarn and operating system version. node.js: 8.11.3 yarn: 1.13.0 OS: OSX El Captain v 10.11.6

paul-soporan commented 3 years ago

You should upgrade to Yarn 2 which has much better PnP support and where you can use packageExtensions to fix this issue.

https://yarnpkg.com/getting-started/migration