npm WARN @babel/helper-compilation-targets@7.20.0 requires a peer of @babel/core@^7.0.0 but none is

**

npm WARN @babel/helper-compilation-targets@7.20.0 requires a peer of @babel/core@^7.0.0 but none is installed. You must install peer dependencies yourse lf.npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\fsevents):npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“win32”,“arch”:“x64”})

**
使用命令行npm install element-plus --save 出现了上面的错误。
大致意思就是缺失了东西。
查了下,是缺啥安装啥。
使用了npm install babel/core@^7.0.0
报错了。

npm ERR! code ENOLOCAL
npm ERR! Could not install from "babel\core@7.0.0" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR!     D:\java\A-soft\Node.js\node_cache\_logs\2022-12-14T07_05_38_569Z-debug.log

进入官方文档查询。运行如下命令:

npm install --save @babel/helper-compilation-targets
npm WARN @babel/helper-compilation-targets@7.20.0 requires a peer of @babel/core@^7.0.0 but none is installed. You must install peer dependencies yourse
lf.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch
":"x64"})

+ @babel/helper-compilation-targets@7.20.0
updated 1 package in 5.801s

85 packages are looking for funding
  run `npm fund` for details

接着再次运行了npm install @babel/core@^7.0.0
出现了一个警告,但是没有出现error,大概是我之前少输入了一个@符号。

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch
":"x64"})

+ @babel/core@7.0.0
added 19 packages from 48 contributors in 17.113s

85 packages are looking for funding
  run `npm fund` for details

这个警告,进行了查询,被安装的原因就是:这个包是mac上可以选择的依赖,但是你使用了window的电脑,也安装了,可以看看你的package.json文件中是不是fsevents的相关依赖,删除就好;其实这个警告是因为mac需要这个包,但是你是在windows环境下,可以忽略这个警告。
强迫症可以按照如下方法,删除这个包:

①在package.json中添加这个对象

"optionalDependencies": {
    "fsevents": "*"
  }

②删除原来安装的包和生成的package-lock.json文件

③重新执行安装命令

npm install --no-optional
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值