简体   繁体   English

如何使用Yarn安装react-phone-number-input?

[英]How to install react-phone-number-input with Yarn?

I want to install the react-phone-number-input package into my Reactjs project. 我想将react-phone-number-input软件包安装到我的Reactjs项目中。 I am using Yarn as my package manager. 我正在使用Yarn作为我的程序包管理器。

So I did the following command 所以我做了以下命令

yarn add react-phone-number-input

and received the following error. 并收到以下错误。

./node_modules/dnd-core/lib/HandlerRegistry.js Module build failed: Error: ENOENT: no such file or directory, open '/path/to/node_modules/dnd-core/lib/HandlerRegistry.js' ./node_modules/dnd-core/lib/HandlerRegistry.js模块构建失败:错误:ENOENT:没有此类文件或目录,请打开“ /path/to/node_modules/dnd-core/lib/HandlerRegistry.js”

What am I doing wrong? 我究竟做错了什么? How can I use Yarn to install react-phone-number-input? 如何使用Yarn安装react-phone-number-input?

Edit 编辑

Based on an answer, I tried the following 根据一个答案,我尝试了以下方法

rm -rf node_modules
yarn autoclean --init # creates .yarnclean file
yarn autoclean --force
yarn install
yarn add react-phone-number-input

and got the following error. 并收到以下错误。

TypeError: _dndCore.DragDropManager is not a constructor TypeError:_dndCore.DragDropManager不是构造函数

You can try remove node_modules, clean up yarn, install again. 您可以尝试删除node_modules,清理纱线,然后重新安装。

rm -rf node_modules
yarn cleanup
yarn install
yarn add react-phone-number-input

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 react-phone-number-input 库与 Formik 成为朋友? - How to friend Formik with react-phone-number-input lib? 反应电话号码输入验证失败 - react-phone-number-input validation failure 使用反应电话号码输入时如何为电话输入的边框颜色设置无 - How to set none for border color of the phone input when using react-phone-number-input React-Phone-Number-Input + React-Hook-Form:如何在控制器验证中获取当前国家代码? - React-Phone-Number-Input + React-Hook-Form: How to get current country code in controller validation? "没有国家选择器的 react-phone-number-input" - react-phone-number-input without the country selector 如何将 react-phone-number-input 与 Formik 的 Field 组件一起使用 - How to use react-phone-number-input with Formik's Field component 如何将 react-phone-number-input 添加到-react-final-form? - How to add react-phone-number-input to -react-final-form? 如何限制 npm react-phone-number-input 包中的国家/地区列表 - How to limited the countries list in npm react-phone-number-input package 如何在 react-phone-number-input 中使用 material-ui TextField - How to use material-ui TextField with react-phone-number-input 如何使用 react-phone-number-input 插入数据?,插入电话号码时出现验证错误 - How can I insert a data using react-phone-number-input?, validation error when I'm inserting a phone number
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM