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

前端 未结 2 630
误落风尘
误落风尘 2020-12-17 21:02

I get the following error when I trying to use babel.

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

webp

相关标签:
2条回答
  • 2020-12-17 21:20

    You need to have babel configured to use those presets. You can add this to your package.json

      "babel": {
        "presets": [
          "es2015",
          "react"
        ]
      },
    

    You can alternatively have a .babelrc file.

    https://babeljs.io/docs/usage/babelrc/

    0 讨论(0)
  • 2020-12-17 21:41

    Try this

    npm install babel-preset-es2015

    npm install babel-preset-react

    npm install babel --save-dev

    This worked for me.

    0 讨论(0)
提交回复
热议问题