首页 > 解决方案 > 从 webpack-cli 获取错误:TypeError: merge.smart is not a function

问题描述

当我这样做时出现错误yarn build,我收到此错误:

TypeError: merge.smart is not a function
     at Object.<anonymous> (/var/www/html/Dragons/PROJETPERSO/PORTFOLIO/config/webpack.prod.js:9:24)
     at Module._compile (/var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/v8-compile-cache/v8-compile-cache.js:194:30)
     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
     at Module.load (internal/modules/cjs/loader.js:1000:32)
     at Function.Module._load (internal/modules/cjs/loader.js:899:14)
     at Module.require (internal/modules/cjs/loader.js:1040:19)
     at require (/var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
     at WEBPACK_OPTIONS (/var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/webpack-cli/bin/utils/convert-argv.js:114:13)
     at requireConfig (/var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/webpack-cli/bin/utils/convert-argv.js:116:6)
     at /var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/webpack-cli/bin/utils/convert-argv.js:123:17
     at Array.forEach (<anonymous>)
     at module.exports (/var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/webpack-cli/bin/utils/convert-argv.js:121:15)
     at /var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/webpack-cli/bin/cli.js:71:45
     at Object.parse (/var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/yargs/yargs.js:576:18)
     at /var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/webpack-cli/bin/cli.js:49:8
     at Object.<anonymous> (/var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/webpack-cli/bin/cli.js:366:3)
     at Module._compile (internal/modules/cjs/loader.js:1151:30)
     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
     at Module.load (internal/modules/cjs/loader.js:1000:32)
     at Function.Module._load (internal/modules/cjs/loader.js:899:14)
     at Module.require (internal/modules/cjs/loader.js:1040:19)
     at require (internal/modules/cjs/helpers.js:72:18)
     at Object.<anonymous> (/var/www/html/Dragons/PROJETPERSO/PORTFOLIO/node_modules/webpack/bin/webpack.js:156:2)
     at Module._compile (internal/modules/cjs/loader.js:1151:30)
     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
     at Module.load (internal/modules/cjs/loader.js:1000:32)
     at Function.Module._load (internal/modules/cjs/loader.js:899:14)
     at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
     at internal/main/run_main_module.js:17:47 error Command failed with exit code 1.

有没有人有任何想法来解决我的问题?

PS:我的 webpack 版本是 4.44.2

标签: webpack

解决方案


尝试将版本降低到 4.2.1


推荐阅读