tailwindlabs / heroicons

A set of free MIT-licensed high-quality SVG icons for UI development.
https://heroicons.com
MIT License
21.35k stars 1.28k forks source link

Unable to import React package with Yarn Berry #227

Closed sumanthratna closed 3 years ago

sumanthratna commented 3 years ago

The Error

/private/tmp/test-heroicons-yarn2/.pnp.js:5070
    throw firstError;
    ^

Error: Qualified path resolution failed - none of the candidates can be found on the disk.

Source path: /private/tmp/test-heroicons-yarn2/.yarn/$$virtual/@heroicons-react-virtual-82c4474c14/0/cache/@heroicons-react-npm-1.0.0-09d9966103-2bf50a52e6.zip/node_modules/@heroicons/react/
Rejected candidate: /private/tmp/test-heroicons-yarn2/.yarn/$$virtual/@heroicons-react-virtual-82c4474c14/0/cache/@heroicons-react-npm-1.0.0-09d9966103-2bf50a52e6.zip/node_modules/@heroicons/react/
Rejected candidate: /private/tmp/test-heroicons-yarn2/.yarn/$$virtual/@heroicons-react-virtual-82c4474c14/0/cache/@heroicons-react-npm-1.0.0-09d9966103-2bf50a52e6.zip/node_modules/@heroicons/react/.js
Rejected candidate: /private/tmp/test-heroicons-yarn2/.yarn/$$virtual/@heroicons-react-virtual-82c4474c14/0/cache/@heroicons-react-npm-1.0.0-09d9966103-2bf50a52e6.zip/node_modules/@heroicons/react/.json
Rejected candidate: /private/tmp/test-heroicons-yarn2/.yarn/$$virtual/@heroicons-react-virtual-82c4474c14/0/cache/@heroicons-react-npm-1.0.0-09d9966103-2bf50a52e6.zip/node_modules/@heroicons/react/.node
Rejected candidate: /private/tmp/test-heroicons-yarn2/.yarn/$$virtual/@heroicons-react-virtual-82c4474c14/0/cache/@heroicons-react-npm-1.0.0-09d9966103-2bf50a52e6.zip/node_modules/@heroicons/react/.mjs
Rejected candidate: /private/tmp/test-heroicons-yarn2/.yarn/$$virtual/@heroicons-react-virtual-82c4474c14/0/cache/@heroicons-react-npm-1.0.0-09d9966103-2bf50a52e6.zip/node_modules/@heroicons/react/index.js
Rejected candidate: /private/tmp/test-heroicons-yarn2/.yarn/$$virtual/@heroicons-react-virtual-82c4474c14/0/cache/@heroicons-react-npm-1.0.0-09d9966103-2bf50a52e6.zip/node_modules/@heroicons/react/index.json
Rejected candidate: /private/tmp/test-heroicons-yarn2/.yarn/$$virtual/@heroicons-react-virtual-82c4474c14/0/cache/@heroicons-react-npm-1.0.0-09d9966103-2bf50a52e6.zip/node_modules/@heroicons/react/index.node
Rejected candidate: /private/tmp/test-heroicons-yarn2/.yarn/$$virtual/@heroicons-react-virtual-82c4474c14/0/cache/@heroicons-react-npm-1.0.0-09d9966103-2bf50a52e6.zip/node_modules/@heroicons/react/index.mjs

Require stack:
- /private/tmp/test-heroicons-yarn2/[eval]
    at internalTools_makeError (/private/tmp/test-heroicons-yarn2/.pnp.js:4814:34)
    at resolveUnqualified (/private/tmp/test-heroicons-yarn2/.pnp.js:5853:13)
    at resolveRequest (/private/tmp/test-heroicons-yarn2/.pnp.js:5877:14)
    at Object.resolveRequest (/private/tmp/test-heroicons-yarn2/.pnp.js:5949:26)
    at Function.external_module_.Module._resolveFilename (/private/tmp/test-heroicons-yarn2/.pnp.js:5047:34)
    at Function.external_module_.Module._load (/private/tmp/test-heroicons-yarn2/.pnp.js:4912:48)
    at Module.require (internal/modules/cjs/loader.js:848:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at [eval]:1:1
    at Script.runInThisContext (vm.js:116:20)

Reproduction

  1. cd /tmp; mkdir test-heroicons-yarn2 && cd test-heroicons-yarn2
  2. yarn init - accept the default on all prompts
  3. yarn set version berry && yarn set version latest
  4. yarn add @heroicons/react
  5. yarn node -e "require('@heroicons/react')" - you'll see the error above

Environment

sumanthratna commented 3 years ago

that was really silly. You need to import @heroicons/react/(outline|solid) as mentioned in the README

I'm leaving this issue open because I think it would be nice to raise a more informative error when someone tries to import the root package

adamwathan commented 3 years ago

Hey! Doing a little house cleaning so going to close this since there’s no actual bug here, but appreciate the feedback and will definitely consider an error here 👍🏻