I just installed a package that is not in npm registry via github like this
yarn add git+https://github.com/azazdeaz/react-color-picker-wheel.git
Now I can see it in my package.json file like this
"react-color-picker-wheel": "git+https://github.com/azazdeaz/react-color-picker-wheel.git"
However when I import it like this
import ColorPickerWheel from 'react-color-picker-wheel'
I get this error
Uncaught Error: Cannot find module 'react-color-picker-wheel'
In the upper-right corner of any page, click , and then click Import repository. Under "Your old repository's clone URL", type the URL of the project you want to import. Choose your personal account or an organization to own the repository, then type a name for the repository on GitHub.
Select Repos, Files. From the repo drop-down, select Import repository. If the source repo is publicly available, just enter the clone URL of the source repository and a name for your new Git repository.
The main
property of the package.json in the Github repo is set to ./lib/index.js
but that file does not exist in the repository.
When you import that module, it tries to resolve the file ./lib/index.js
relative to the node_modules/react-color-picker
directory.
You could submit a PR to update the package.json
's main property to refer to the correct file (./src/index.js
, or fork the repository and update the Github url to your repo's URL. It's worth checking out the NPM docs about the main
property as well :)
https://docs.npmjs.com/files/package.json#main
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With