最新消息:20190529 VPS服务器已从腾讯云香港换为Vultr新加坡,主题仍用朋友推荐的大前端D8

【已解决】npm WARN deprecated babel@6.23.0 babel-preset-es2015@6.24.1

npm crifan 2322浏览 0评论

折腾:

【临时解决】webpack打包失败:ERROR in bundle js from UglifyJs Unexpected token punc

期间,不过发现:

npm install > npm_install_20171024.log

输出的log中,提示:

npm WARN deprecated babel@6.23.0: In 6.x, the babel package has been deprecated in favor of babel-cli. Check https://opencollective.com/babel to support the Babel maintainers
npm WARN deprecated babel-preset-es2015@6.24.1: 🙌  Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!

怀疑之前问题就是babel引起的,所以还是去根据建议去:

把babel-preset-es2015换成babel-preset-env

https://opencollective.com/babel

目前还打不开:Internal Server Error

所以先去看看:

babel-preset-es2015 -> babel-preset-env · Babel

babel/babel-preset-env: Autoprefixer for Babel: compile less (moved)

所以,去换

➜  ucowsapp_h5_en git:(master) ✗ npm install babel-preset-env –save-dev
ucows-app@2017.10.23 /Users/crifan/dev/dev_root/daryun/Projects/xxx/ucowsapp_h5_en
└── babel-preset-env@1.6.1

删除之前的:

“babel-preset-es2015”: “^6.24.0”,

.babelrc中改为:

{
  “sourceMaps”: true,
  “presets”: [
    [
      “env”,
      {
        “loose”: true
      }
    ],
    “stage-0”
  ],
  “plugins”: [
    [“transform-decorators-legacy”],
    [“transform-react-jsx”, { “pragma”: “h” }]
  ]
}

注:

babel-preset-env包括了之前的:

  • babel-preset-es2015, babel-preset-es2016, babel-preset-es2017

  • babel-preset-latest

  • 其他社区的es20xx

    • babel-preset-node5, babel-preset-es2015-node, 等等

先去看看 npm run build是否解决了

结果问题依旧:ERROR in bundle_2e70388dd90039cb3b05.js from UglifyJs

否则待会再去看看那个babel的:

In 6.x, the babel package has been deprecated in favor of babel-cli

Getting weird error – Use the `babel-core` package not `babel`. · Issue #5506 · babel/babel

iView 脚手架工具报错 the babel package has been deprecated in favor of babel-cli. · Issue #1201 · iview/iview

安装ssmgr的出错信息 · Issue #220 · shadowsocks/shadowsocks-manager

npmdoc-babel

Upgrade to Babel 7 (WIP) · Babel

官网是废了babel v6,建议换用babel-cli,且也不打算发布v7了

[7.0] remove standalone babel package by hzoo · Pull Request #5293 · babel/babel

npmdoc/node-npmdoc-babel – Libraries.io

所以去试试,去掉:

“babel”: “^6.5.2”,

再去:

npm install babel-cli –save-dev

➜  ucowsapp_h5_en git:(master) ✗ npm install babel-cli –save-dev
ucows-app@2017.10.23 /Users/crifan/dev/dev_root/xxx/ucowsapp_h5_en
└─┬ babel-cli@6.26.0
  ├── fs-readdir-recursive@1.0.0
  ├── glob@7.1.2
  ├── output-file-sync@1.1.2
  ├── source-map@0.5.7
  └─┬ v8flags@2.1.1
    └── user-home@1.1.1

【总结】

此处根据提示去把:

babel换为babel-cli

babel-preset-es2015换为babel-preset-env

即可。

转载请注明:在路上 » 【已解决】npm WARN deprecated babel@6.23.0 babel-preset-es2015@6.24.1

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
63 queries in 0.078 seconds, using 18.81MB memory