npm安装警告:babel警告消息

时间:2018-01-31 05:28:07

标签: npm babeljs

我的问题是如何处理npm install的以下输出中列出的警告?似乎输出消息要求我运行此命令:

npm install babel-preset-env --save-dev

这是正确的做法吗?或者我可以忽略这一点。我正在开始一个React项目,我确实需要babel正常运行。谢谢。

这是我在项目目录中运行npm install时得到的输出:

λ npm install
npm WARN deprecated babel-preset-latest@6.14.0: We're super �  excited that you're trying to use ES2017+ syntax, but
 instead of making more yearly presets � , Babel now has a better preset that we recommend you use instead: npm inst
all babel-preset-env --save-dev. preset-env without options will compile ES2015+ down to ES5 just like using all the
 presets together and thus is more future proof. It also allows you to target specific browsers so that Babel can do
 less work and you can ship native ES2015+ to user � ! We are also in the process of releasing v7, so please give ht
tp://babeljs.io/blog/2017/09/12/planning-for-7.0 a read and help test it out in beta! Thanks so much for using Babel
 �, please give us a follow on Twitter @babeljs for news on Babel, join slack.babeljs.io for discussion/development
and help support the project at opencollective.com/babel
npm WARN deprecated babel-preset-es2017@6.24.1: �  Thanks for using Babel: we recommend using babel-preset-env now:
please read babeljs.io/env to update!
npm WARN deprecated babel-preset-es2016@6.24.1: �  Thanks for using Babel: we recommend using babel-preset-env now:
please read babeljs.io/env to update!
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!
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.0.14 (node_modules\react-scripts\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.14: wanted {"os":"darwin","arch":"any"} (current: >     {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.0.14 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.14: wanted {"os":"darwin","arch":"any"} (current: >     {"os":"win32","arch":"x64"})
added 1143 packages in 409.143s

我的环境:

  • win7 ultimate x64(SP1)
  • npm v5.6.0
  • 代码编辑器:VSCode v1.19.3

1 个答案:

答案 0 :(得分:0)

该警告是因为您package.json已经在其中列出了不再推荐的其他预设。安装babel-preset-env并使用它是正确的做法,但您仍应删除它替换的其他预设。