Module build failed (from ./node_modules/_babel-loader@7.1.5@babel-loader/lib/index.js):
PS D:\vuelearn\VueLearn\03-前端模块化\LearnVuejs04-v2\01-webpack的使用\03-webpack的loader> npm run build> metpkg@1.0.0 build D:\vuelearn\VueLearn\03-前端模块化\LearnVuejs04-v2\01-webpack的使用\03-webpack的loader&
PS D:\vuelearn\VueLearn\03-前端模块化\LearnVuejs04-v2\01-webpack的使用\03-webpack的loader> npm run build
> metpkg@1.0.0 build D:\vuelearn\VueLearn\03-前端模块化\LearnVuejs04-v2\01-webpack的使用\03-webpack的loader
> webpack
assets by status 2.42 KiB [cached] 1 asset
./src/main.js 39 bytes [built] [code generated] [1 error]
WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'developm
ent' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/
ERROR in ./src/main.js
Module build failed (from ./node_modules/_babel-loader@7.1.5@babel-loader/lib/index.js):
ReferenceError: Unknown plugin "transform-runtime" specified in "D:\\vuelearn\\VueLearn\\03-前端模块化\\LearnVuejs04-v2\
\01-webpack的使用\\03-webpack的loader\\.babelrc" at 0, attempted to resolve relative to "D:\\vuelearn\\VueLearn\\03-前端
模块化\\LearnVuejs04-v2\\01-webpack的使用\\03-webpack的loader"
at D:\vuelearn\VueLearn\03-前端模块化\LearnVuejs04-v2\01-webpack的使用\03-webpack的loader\node_modules\_babel-core@6
.26.3@babel-core\lib\transformation\file\options\option-manager.js:180:17
at Array.map (<anonymous>)
at Function.normalisePlugins (D:\vuelearn\VueLearn\03-前端模块化\LearnVuejs04-v2\01-webpack的使用\03-webpack的loader
\node_modules\_babel-core@6.26.3@babel-core\lib\transformation\file\options\option-manager.js:158:20)
at OptionManager.mergeOptions (D:\vuelearn\VueLearn\03-前端模块化\LearnVuejs04-v2\01-webpack的使用\03-webpack的loade
r\node_modules\_babel-core@6.26.3@babel-core\lib\transformation\file\options\option-manager.js:234:36)
at OptionManager.init (D:\vuelearn\VueLearn\03-前端模块化\LearnVuejs04-v2\01-webpack的使用\03-webpack的loader\node_m
odules\_babel-core@6.26.3@babel-core\lib\transformation\file\options\option-manager.js:368:12)
at File.initOptions (D:\vuelearn\VueLearn\03-前端模块化\LearnVuejs04-v2\01-webpack的使用\03-webpack的loader\node_mod
ules\_babel-core@6.26.3@babel-core\lib\transformation\file\index.js:212:65)
at new File (D:\vuelearn\VueLearn\03-前端模块化\LearnVuejs04-v2\01-webpack的使用\03-webpack的loader\node_modules\_ba
bel-core@6.26.3@babel-core\lib\transformation\file\index.js:135:24)
at Pipeline.transform (D:\vuelearn\VueLearn\03-前端模块化\LearnVuejs04-v2\01-webpack的使用\03-webpack的loader\node_m
odules\_babel-core@6.26.3@babel-core\lib\transformation\pipeline.js:46:16)
at transpile (D:\vuelearn\VueLearn\03-前端模块化\LearnVuejs04-v2\01-webpack的使用\03-webpack的loader\node_modules\_b
abel-loader@7.1.5@babel-loader\lib\index.js:50:20)
at Object.module.exports (D:\vuelearn\VueLearn\03-前端模块化\LearnVuejs04-v2\01-webpack的使用\03-webpack的loader\nod
e_modules\_babel-loader@7.1.5@babel-loader\lib\index.js:173:20)
webpack 5.17.0 compiled with 1 error and 1 warning in 933 ms
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! metpkg@1.0.0 build: `webpack`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the metpkg@1.0.0 build 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! D:\Program Files\nodejs\node_cache\_logs\2021-01-26T09_00_54_161Z-debug.log
PS D:\vuelearn\VueLearn\03-前端模块化\LearnVuejs04-v2\01-webpack的使用\03-webpack的loader> npm run build
> metpkg@1.0.0 build D:\vuelearn\VueLearn\03-前端模块化\LearnVuejs04-v2\01-webpack的使用\03-webpack的loader
> webpack
assets by status 2.31 KiB [cached] 1 asset
./src/main.js 39 bytes [built] [code generated] [1 error]
WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'developm
ent' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/
ERROR in ./src/main.js
Module build failed (from ./node_modules/_babel-loader@7.1.5@babel-loader/lib/index.js):
Error: Couldn't find preset "es2015" relative to directory "D:\\vuelearn\\VueLearn\\03-前端模块化\\LearnVuejs04-v2\\01-w
ebpack的使用\\03-webpack的loader\\src"
at D:\vuelearn\VueLearn\03-前端模块化\LearnVuejs04-v2\01-webpack的使用\03-webpack的loader\node_modules\_babel-core@6
.26.3@babel-core\lib\transformation\file\options\option-manager.js:293:19
at Array.map (<anonymous>)
at OptionManager.resolvePresets (D:\vuelearn\VueLearn\03-前端模块化\LearnVuejs04-v2\01-webpack的使用\03-webpack的loa
der\node_modules\_babel-core@6.26.3@babel-core\lib\transformation\file\options\option-manager.js:275:20)
at OptionManager.mergePresets (D:\vuelearn\VueLearn\03-前端模块化\LearnVuejs04-v2\01-webpack的使用\03-webpack的loade
r\node_modules\_babel-core@6.26.3@babel-core\lib\transformation\file\options\option-manager.js:264:10)
at OptionManager.mergeOptions (D:\vuelearn\VueLearn\03-前端模块化\LearnVuejs04-v2\01-webpack的使用\03-webpack的loade
r\node_modules\_babel-core@6.26.3@babel-core\lib\transformation\file\options\option-manager.js:249:14)
at OptionManager.init (D:\vuelearn\VueLearn\03-前端模块化\LearnVuejs04-v2\01-webpack的使用\03-webpack的loader\node_m
odules\_babel-core@6.26.3@babel-core\lib\transformation\file\options\option-manager.js:368:12)
at File.initOptions (D:\vuelearn\VueLearn\03-前端模块化\LearnVuejs04-v2\01-webpack的使用\03-webpack的loader\node_mod
ules\_babel-core@6.26.3@babel-core\lib\transformation\file\index.js:212:65)
at new File (D:\vuelearn\VueLearn\03-前端模块化\LearnVuejs04-v2\01-webpack的使用\03-webpack的loader\node_modules\_ba
bel-core@6.26.3@babel-core\lib\transformation\file\index.js:135:24)
at Pipeline.transform (D:\vuelearn\VueLearn\03-前端模块化\LearnVuejs04-v2\01-webpack的使用\03-webpack的loader\node_m
odules\_babel-core@6.26.3@babel-core\lib\transformation\pipeline.js:46:16)
at transpile (D:\vuelearn\VueLearn\03-前端模块化\LearnVuejs04-v2\01-webpack的使用\03-webpack的loader\node_modules\_b
abel-loader@7.1.5@babel-loader\lib\index.js:50:20)
解决办法:安装babel-preset-es2015
PS D:\vuelearn\VueLearn\03-前端模块化\LearnVuejs04-v2\01-webpack的使用\03-webpack的loader> cnpm install --save-dev babel-preset-es2015
√ Installed 1 packages
√ Linked 24 latest versions
√ Run 0 scripts
deprecate babel-preset-es2015@* ???? Thanks for using Babel: we recommend using babel-preset-env now: please read https
://babeljs.io/env to update!
√ All packages installed (1 packages installed from npm registry, used 367ms(network 363ms), speed 221.72kB/s, json 25(
80.49kB), tarball 0B)
PS D:\vuelearn\VueLearn\03-前端模块化\LearnVuejs04-v2\01-webpack的使用\03-webpack的loader>
PS D:\vuelearn\VueLearn\03-前端模块化\LearnVuejs04-v2\01-webpack的使用\03-webpack的loader> cnpm install --save-dev babel
-preset-es2015^C
× Install fail! Error: [@babel-preset-es2015╚] resolved target D:\vuelearn\VueLearn\03-前端模块化\LearnVuejs04-v2\01-we
bpack的使用\03-webpack的loader\babel-preset-es2015╚ error: ENOENT: no such file or directory, lstat 'D:\vuelearn\VueLear
n\03-前端模块化\LearnVuejs04-v2\01-webpack的使用\03-webpack的loader\babel-preset-es2015╚'
PS D:\vuelearn\VueLearn\03-前端模块化\LearnVuejs04-v2\01-webpack的使用\03-webpack的loader>
PS D:\vuelearn\VueLearn\03-前端模块化\LearnVuejs04-v2\01-webpack的使用\03-webpack的loader>
结果验证成功
PS D:\vuelearn\VueLearn\03-前端模块化\LearnVuejs04-v2\01-webpack的使用\03-webpack的loader> npm run build
> metpkg@1.0.0 build D:\vuelearn\VueLearn\03-前端模块化\LearnVuejs04-v2\01-webpack的使用\03-webpack的loader
> webpack
assets by status 137 KiB [cached] 2 assets
asset bundle.js 5.11 KiB [emitted] [minimized] (name: main)
runtime modules 963 bytes 5 modules
cacheable modules 12.2 KiB
modules by path ./css/ 1.89 KiB
modules by path ./css/*.css 1.09 KiB 2 modules
modules by path ./css/*.less 820 bytes 2 modules
modules by path ./src/*.js 1.13 KiB 3 modules
modules by path ./node_modules/ 9.04 KiB
./node_modules/_style-loader@2.0.0@style-loader/dist/runtime/injectStylesIntoStyleTag.js 6.67 KiB [built] [code gene
rated]
./node_modules/_css-loader@5.0.1@css-loader/dist/runtime/api.js 1.57 KiB [built] [code generated]
./node_modules/_css-loader@5.0.1@css-loader/dist/runtime/getUrl.js 830 bytes [built] [code generated]
modules by path ./img/*.jpg 131 bytes
./img/test.jpg 65 bytes [built] [code generated]
./img/test1.jpg 66 bytes [built] [code generated]
WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'developm
ent' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/
webpack 5.17.0 compiled with 1 warning in 4148 ms
更多推荐
所有评论(0)