简体   繁体   English

webpack encore 构建错误中的错误:模块构建失败:未关闭的块

[英]Error in webpack encore build error: Module build failed: Unclosed block

I get an error when building my webpack using encore in symfony .symfony中使用 encore 构建我的webpack时出现错误。

I've tried various time removing node_modules.我尝试过多次删除 node_modules。 and reinstall with yarn install.并使用纱线安装重新安装。 But can't find the solution.但是找不到解决办法。 It has been working before, but I think after update, it broke.它以前一直在工作,但我认为更新后它坏了。 When I uncomment the bootstrap line everything builds.当我取消注释引导行时,一切都会建立。

global.scss全局.scss

// customize some Bootstrap variables
$primary: darken(#49a94a, 10%);

// the ~ allows you to reference things in node_modules
@import "~bootstrap/scss/bootstrap";

@import '~@fortawesome/fontawesome-free/css/all.css';

yarn encore dev纱线安可开发

Running webpack ...

 ERROR  Failed to compile with 2 errors                                                                                                       23:05:40

 error  in ./assets/css/global.scss

Module build failed: ModuleBuildError: Module build failed: Unclosed block (229:4)

  227 | 
  228 | svg {
> 229 |   overflow: hidden;
      |    ^
  230 |   vertical-align: middle;
  231 | }
  232 | 

    at /home/user/Web/kcl_symfony4/node_modules/webpack/lib/NormalModule.js:195:19
    at /home/user/Web/kcl_symfony4/node_modules/loader-runner/lib/LoaderRunner.js:367:11
    at /home/user/Web/kcl_symfony4/node_modules/loader-runner/lib/LoaderRunner.js:233:18
    at context.callback (/home/user/Web/kcl_symfony4/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
    at Object.<anonymous> (/home/user/Web/kcl_symfony4/node_modules/css-loader/lib/loader.js:31:18)
    at /home/user/Web/kcl_symfony4/node_modules/css-loader/lib/processCss.js:222:4

 error  in ./assets/css/global.scss

Module build failed: Unclosed block (229:4)

  227 | 
  228 | svg {
> 229 |   overflow: hidden;
      |    ^
  230 |   vertical-align: middle;
  231 | }
  232 | 


 @ ./assets/css/global.scss 4:14-199
 @ ./assets/js/app.js

error Command failed with exit code 2.

I've tried with building Bootstrap scss standalone and that works.我尝试过独立构建 Bootstrap scss 并且有效。 That why I think something is wrong with node_modules.这就是为什么我认为 node_modules 有问题的原因。

Problem fixed by updating @symfony/webpack-encore.通过更新 @symfony/webpack-encore 解决了问题。 Found solution here: https://github.com/BlackrockDigital/startbootstrap-sb-admin-2/issues/287在这里找到解决方案: https://github.com/BlackrockDigital/startbootstrap-sb-admin-2/issues/287

Problem fixed by updating @symfony/webpack-encore to most current version in the package.json file.通过将 @symfony/webpack-encore 更新到 package.json 文件中的最新版本解决了问题。 After running "yarn upgrade" it worked.运行“纱线升级”后,它起作用了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Webpack:模块构建失败:错误:找不到模块“postcss” - Webpack: Module build failed: Error: Cannot find module 'postcss' Webpack Encore-模块规则-将scss变量导出/导入javascript时出错 - Webpack Encore - Module rules - Error when export/import scss variables into javascript 错误:模块构建失败(来自./node_modules/sass-loader/dist/cjs.js) - Error: Module build failed (from ./node_modules/sass-loader/dist/cjs.js) CSS_MODULES:模块构建失败,带有extract-text-webpack-plugin - CSS_MODULES: Module build failed with extract-text-webpack-plugin 当 sass 文件中有 url 时,Webpack 模块构建失败 - Webpack module build failing when there are url's in the sass file SASS 抛出错误 Undefined Mixins: Module build failed (from./node_modules/sass-loader/dist/cjs.js): SassError: Undefined mixin - SASS throws an error Undefined Mixins: Module build failed (from ./node_modules/sass-loader/dist/cjs.js): SassError: Undefined mixin Scss 错误:./src/routes/styles/home.scss -> 模块构建失败(来自./node_modules/resolve-url-loader/index.js): - Scss error: ./src/routes/styles/home.scss -> Module build failed (from ./node_modules/resolve-url-loader/index.js): 错误使用Webpack找不到模块 - error Cannot find module using webpack 用reactjs导入Css显示错误“未封闭的字符串” - importing Css with reactjs shows error “ Unclosed string” grunt版本出现“ Broken @import”错误? - “Broken @import” error with grunt build?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM