7

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'

1 Answer 1

4

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.