Error: Couldn't find preset “es2015” relative to directory “/Users/username”

前端 未结 12 1486
孤城傲影
孤城傲影 2020-12-13 16:59

I get the following error when trying to use gulp-babel:

Error: Couldn\'t find preset \"es2015\" relative to directory \"/Users/username\"

12条回答
  •  爱一瞬间的悲伤
    2020-12-13 17:20

    Babel 7 update

    From the docs you should now use @babel/preset-env instead of any other preset mention

    The "env" preset has been out for more than a year now, and completely replaces some of the presets we've had/suggested earlier.

    • babel-preset-es2015
    • babel-preset-es2016
    • babel-preset-es2017
    • babel-preset-latest
    • A combination of the above ^
    yarn add @babel/preset-env
    

    or

    npm install @babel/preset-env
    

提交回复
热议问题