The @emotion/core package has been renamed to @emotion/react

8 篇文章 0 订阅

在antd4升级到5时候,因为版本5弃用 less,采用 CSS-in-JS,所以安装了@emotion/core和@emotion/styled

执行命令:

npm install @emotion/core @emotion/styled

但是运行后,页面报错:

The @emotion/core package has been renamed to @emotion/react. Please import it like this import { jsx } from '@emotion/react'

解决方案:

npm install @emotion/core@10.1.1

执行报错的话,在后面加上"--force"或者"--legacy-peer-deps"

f 或 --force:将强制 npm 获取远程资源,即使磁盘上存在本地副本也是如此。
–legacy-peer-deps:在安装时忽略所有 peerDependencies,采用 npm 版本 4 到版本 6 的样式。

如果在React应用程序中使用@emotion/core时出错:

添加包含

declare module '@emotion/core'

ts的新声明(.d.ts)文件

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值