vue引入element-ui,運(yùn)行時(shí)報(bào)了這個(gè)錯(cuò)誤
Module build failed: Error: Couldn't find preset "es2015" relative to directory "D:\\360MoveData\\Users\\Administrator\\Desktop\\新建文件夾\\henge-test"
at D:\360MoveData\Users\Administrator\Desktop\新建文件夾\henge-test\node_modules\babel-core\lib\transformation\file\options\option-manager.js:293:19
at Array.map (<anonymous>)
at OptionManager.resolvePresets (D:\360MoveData\Users\Administrator\Desktop\新建文件夾\henge-test\node_modules\babel-core\lib\transformation\file\options\option-manager.js:275:20)
at OptionManager.mergePresets (D:\360MoveData\Users\Administrator\Desktop\新建文件夾\henge-test\node_modules\babel-core\lib\transformation\file\options\option-manager.js:264:10)
at OptionManager.mergeOptions (D:\360MoveData\Users\Administrator\Desktop\新建文件夾\henge-test\node_modules\babel-core\lib\transformation\file\options\option-manager.js:249:14)
at OptionManager.init (D:\360MoveData\Users\Administrator\Desktop\新建文件夾\henge-test\node_modules\babel-core\lib\transformation\file\options\option-manager.js:368:12)
at File.initOptions (D:\360MoveData\Users\Administrator\Desktop\新建文件夾\henge-test\node_modules\babel-core\lib\transformation\file\index.js:212:65)
at new File (D:\360MoveData\Users\Administrator\Desktop\新建文件夾\henge-test\node_modules\babel-core\lib\transformation\file\index.js:135:24) at Pipeline.transform (D:\360MoveData\Users\Administrator\Desktop\新建文件夾\henge-test\node_modules\babel-core\lib\transformation\pipeline.js:46:16)
at transpile (D:\360MoveData\Users\Administrator\Desktop\新建文件夾\henge-test\node_modules\babel-loader\lib\index.js:50:20)
at Object.module.exports (D:\360MoveData\Users\Administrator\Desktop\新建文件夾\henge-test\node_modules\babel-loader\lib\index.js:173:20)
@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js
按照element-ui中的步驟 把.babelrc 文件內(nèi)容從
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
}
}],
"stage-2"
],
"plugins": ["transform-vue-jsx", "transform-runtime"]
}
更改為了
{
"presets": [["es2015", { "modules": false }]],
"plugins": [
[
"component",
{
"libraryName": "element-ui",
"styleLibraryName": "theme-chalk"
}
]
]
}
然后運(yùn)行時(shí)就報(bào)了這個(gè)問(wèn)題文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-665028.html
解決方案:
安裝es2015 工具文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-665028.html
npm install --save-dev babel-preset-es2015
到了這里,關(guān)于Error: Couldn‘t find preset “es2015“ relative to directory的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!