【问题标题】:How to install react-phone-number-input with Yarn?如何使用 Yarn 安装 react-phone-number-input?
【发布时间】:2018-09-25 17:05:44
【问题描述】:

我想将react-phone-number-input 包安装到我的 Reactjs 项目中。我使用 Yarn 作为我的包管理器。

所以我做了以下命令

yarn add react-phone-number-input

并收到以下错误。

./node_modules/dnd-core/lib/HandlerRegistry.js 模块构建失败:错误:ENOENT:没有这样的文件或目录,打开 '/path/to/node_modules/dnd-core/lib/HandlerRegistry.js'

我做错了什么?如何使用 Yarn 安装 react-phone-number-input?

编辑

根据答案,我尝试了以下方法

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

并得到以下错误。

TypeError: _dndCore.DragDropManager 不是构造函数

【问题讨论】:

  • 更新所有依赖项并重试
  • 您也可以尝试升级 yarn 本身(通过 npm),但在此之前,使用 yarn 删除包,然后使用 运行 yarn add--对等,这可能也有帮助

标签: reactjs npm yarnpkg


【解决方案1】:

你可以尝试删除node_modules,清理yarn,重新安装。

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

【讨论】:

  • 我没有看到yarn cleanup 命令。你的意思是yarn autoclean
猜你喜欢
  • 2020-07-09
  • 1970-01-01
  • 2022-08-08
  • 2023-02-09
  • 2020-10-18
  • 1970-01-01
  • 1970-01-01
  • 2017-02-21
  • 2021-02-12
相关资源
最近更新 更多