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

前端 未结 12 1499
孤城傲影
孤城傲影 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条回答
  •  猫巷女王i
    2020-12-13 17:34

    I just had a really weird one. I installed all the babel tools with one big long npm install command, and everything installed without errors... except it was throwing the error documented in this thread, at runtime.

    I noticed the version was 0.0.0 in the package.json file, so I ran npm install --save-dev babel-preset-es2015 again and it worked and placed a SECOND key into my package.json file:

       "devDependencies": {
         "babel-cli": "^6.24.1",
         "babel-core": "^6.24.1",
         "babel-polyfill": "^6.23.0",
         "babel-preset-es2015": "^6.24.1",
         "babel-preset-es2015": "0.0.0",
         "babel-preset-stage-2": "^6.24.1",
         "eslint": "^3.19.0"
       }
    

    I just removed the botched entry and it cleared up this relative to directory error.

提交回复
热议问题