Node.js 导入从github安装的包

Node.js 导入从github安装的包,node.js,npm,import,package,Node.js,Npm,Import,Package,我刚刚通过github安装了一个不在npm注册表中的包,如下所示 yarn add git+https://github.com/azazdeaz/react-color-picker-wheel.git "react-color-picker-wheel": "git+https://github.com/azazdeaz/react-color-picker-wheel.git" import ColorPickerWheel from 'react-color-picker-wheel

我刚刚通过github安装了一个不在npm注册表中的包,如下所示

yarn add git+https://github.com/azazdeaz/react-color-picker-wheel.git
"react-color-picker-wheel": "git+https://github.com/azazdeaz/react-color-picker-wheel.git"
import ColorPickerWheel from 'react-color-picker-wheel'
现在我可以在package.json文件中看到它,如下所示

yarn add git+https://github.com/azazdeaz/react-color-picker-wheel.git
"react-color-picker-wheel": "git+https://github.com/azazdeaz/react-color-picker-wheel.git"
import ColorPickerWheel from 'react-color-picker-wheel'
但是当我这样导入它时

yarn add git+https://github.com/azazdeaz/react-color-picker-wheel.git
"react-color-picker-wheel": "git+https://github.com/azazdeaz/react-color-picker-wheel.git"
import ColorPickerWheel from 'react-color-picker-wheel'
我得到这个错误
未捕获错误:找不到模块'react color picker wheel'

Github repo中的
main
属性设置为
/lib/index.js
,但该文件在存储库中不存在

导入该模块时,它会尝试解析文件
/lib/index.js
,该文件与
节点\u modules/react color picker
目录相关

您可以提交PR来更新
package.json
的主属性,以引用正确的文件(
/src/index.js
,或者分叉存储库并将Github url更新为您的回购url。关于
主属性的NPM文档也值得一看:)