babel安装失败/报错详细解决方案

**问题:**在VSCode中执行命令 npm install --global babel-cli
报以下错误:
core-js@2.6.12: core-js@❤️.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.

解决方案:

  1. 首先在cmd中打开你要安装babel的目录,我的是:E:\VSCode\npm\node-globalbabel安装失败/报错详细解决方案报以下错误: core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended
  2. 全局安装,输入命令 npm install --global @babel/core @babel/cli
    babel安装失败/报错详细解决方案报以下错误: core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended3.查看是否安装成功
babel --version

babel安装失败/报错详细解决方案报以下错误: core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended4.查看是否其它位置使用babel --version,比如来到D盘
babel安装失败/报错详细解决方案报以下错误: core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended我这里成功,是因为我已经配置了环境变量path
5.你如果报如下错误: “‘babel’ 不是内部或外部命令,也不是可运行的程序或批处理文件。” 去配置环境变量path
配置环境变量:

  1. 鼠标右键此电脑,点击属性

babel安装失败/报错详细解决方案报以下错误: core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended
2.下拉找到高级系统设置babel安装失败/报错详细解决方案报以下错误: core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended3.点击环境变量
babel安装失败/报错详细解决方案报以下错误: core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended
4.找到path,点击编辑
babel安装失败/报错详细解决方案报以下错误: core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended5.点击新建,输入刚刚上面babel的安装目录 E:\VSCode\npm\node-global,然后确定

babel安装失败/报错详细解决方案报以下错误: core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended6.最后再次验证是否成功,配置好变量一定要重新打开cmd窗口,出现版本号就成功了
babel安装失败/报错详细解决方案报以下错误: core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended
补充:如果就es6转为es5时报Plugin/Preset files are not allowed to export objects,only functions.
去这个大佬这里解决:http://t.csdn.cn/yeKj2

发表回复