一创建了 .babelrc文件,项目运行失败
来源:11-2 ElementUI运用

_YI__
2020-03-06
这是错误代码
> mall@0.1.0 serve E:\HBuliderX-yuan\vue-cli4全家桶实战\mall
> vue-cli-service serve --mode=development
ERROR Error: Cannot find module 'babel-preset-es2015' from 'E:\HBuliderX-yuan\vue-cli4全家桶实战\mall'
Error: Cannot find module 'babel-preset-es2015' from 'E:\HBuliderX-yuan\vue-cli4全家桶实战\mall'
at Function.resolveSync [as sync] (E:\HBuliderX-yuan\vue-cli4全家桶实战\mall\node_modules\_resolve@1.15.1@resolve\lib\sync.js:81:15)
at resolveStandardizedName (E:\HBuliderX-yuan\vue-cli4全家桶实战\mall\node_modules\_@babel_core@7.8.7@@babel\core\lib\config\files\plugins.js:101:31)
at resolvePreset (E:\HBuliderX-yuan\vue-cli4全家桶实战\mall\node_modules\_@babel_core@7.8.7@@babel\core\lib\config\files\plugins.js:58:10)
at loadPreset (E:\HBuliderX-yuan\vue-cli4全家桶实战\mall\node_modules\_@babel_core@7.8.7@@babel\core\lib\config\files\plugins.js:77:20)
at createDescriptor (E:\HBuliderX-yuan\vue-cli4全家桶实战\mall\node_modules\_@babel_core@7.8.7@@babel\core\lib\config\config-descriptors.js:154:9)
at E:\HBuliderX-yuan\vue-cli4全家桶实战\mall\node_modules\_@babel_core@7.8.7@@babel\core\lib\config\config-descriptors.js:109:50
at Array.map (<anonymous>)
at createDescriptors (E:\HBuliderX-yuan\vue-cli4全家桶实战\mall\node_modules\_@babel_core@7.8.7@@babel\core\lib\config\config-descriptors.js:109:29)
at createPresetDescriptors (E:\HBuliderX-yuan\vue-cli4全家桶实战\mall\node_modules\_@babel_core@7.8.7@@babel\core\lib\config\config-descriptors.js:101:10)
at presets (E:\HBuliderX-yuan\vue-cli4全家桶实战\mall\node_modules\_@babel_core@7.8.7@@babel\core\lib\config\config-descriptors.js:47:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mall@0.1.0 serve: `vue-cli-service serve --mode=development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mall@0.1.0 serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\DELL\AppData\Roaming\npm-cache\_logs\2020-03-06T09_45_04_742Z-debug.log
已经删除过依赖再安装了还是不行
写回答
2回答
-
babelrc最后会和babel.config合并,你先把这几节课看完,在处理。
022020-03-06 -
慕移动9059126
2021-11-19
.babelrc文件和babel.config.js文件(安装后自动生成的)都是配置文件,可以视为相同,我就没有添加.babelrc文件。
之后需要使用npm安装
npm i @babel/preset-env --save-dev
而且,也不再使用es2015,改成@babel/preset-env,两者是相同的,其作用都是编译es6语法。
在babel.config.js中改写成即可
module.exports = { presets: [ '@vue/cli-plugin-babel/preset', ["@babel/preset-env", { "modules": false }] ], "plugins": [ [ "component", { "libraryName": "element-ui", "styleLibraryName": "theme-chalk" } ] ] }
我是百度解决的,也不知道后面老师是咋修改的,我就是看到bug不修改就不太舒服,后面学习的同学遇到这个问题,可以修改
100
相似问题
怎么样自己创建一个github的库
回答 1
构建vuecli
回答 2