• Vue npm run build 错误 CssSyntaxError:xxxx.Unknown word


    错误提示

    building for production...Error processing file: static/css/app.df86e347a94aed52aa7bb0b865b3f053.css
    (node:8868) UnhandledPromiseRejectionWarning: CssSyntaxError: D:WorkspaceTestExercisevueDemovue-modulestaticcssapp.df86e347a94aed52aa7bb0b865b3f053.css:49:45: Unknown word
        at Input.error (D:WorkspaceTestExercisevueDemovue-module
    ode_modulesoptimize-css-assets-webpack-plugin
    ode_modulespostcsslibinput.js:130:16)
        at Parser.unknownWord (D:WorkspaceTestExercisevueDemovue-module
    ode_modulesoptimize-css-assets-webpack-plugin
    ode_modulespostcsslibparser.js:563:22)
        at Parser.decl (D:WorkspaceTestExercisevueDemovue-module
    ode_modulesoptimize-css-assets-webpack-plugin
    ode_modulespostcsslibparser.js:235:16)
        at Parser.other (D:WorkspaceTestExercisevueDemovue-module
    ode_modulesoptimize-css-assets-webpack-plugin
    ode_modulespostcsslibparser.js:133:18)
        at Parser.parse (D:WorkspaceTestExercisevueDemovue-module
    ode_modulesoptimize-css-assets-webpack-plugin
    ode_modulespostcsslibparser.js:77:16)
        at parse (D:WorkspaceTestExercisevueDemovue-module
    ode_modulesoptimize-css-assets-webpack-plugin
    ode_modulespostcsslibparse.js:17:12)
        at new LazyResult (D:WorkspaceTestExercisevueDemovue-module
    ode_modulesoptimize-css-assets-webpack-plugin
    ode_modulespostcssliblazy-result.js:60:16)
        at Processor.<anonymous> (D:WorkspaceTestExercisevueDemovue-module
    ode_modulesoptimize-css-assets-webpack-plugin
    ode_modulespostcsslibprocessor.js:138:12)
        at Processor.process (D:WorkspaceTestExercisevueDemovue-module
    ode_modulesoptimize-css-assets-webpack-plugin
    ode_modulespostcsslibprocessor.js:117:23)
        at Function.creator.process (D:WorkspaceTestExercisevueDemovue-module
    ode_modulesoptimize-css-assets-webpack-plugin
    ode_modulespostcsslibpostcss.js:148:43)
        at OptimizeCssAssetsPlugin.processCss (D:WorkspaceTestExercisevueDemovue-module
    ode_modulesoptimize-css-assets-webpack-pluginindex.js:63:19)
        at Object.processor (D:WorkspaceTestExercisevueDemovue-module
    ode_modulesoptimize-css-assets-webpack-pluginindex.js:29:23)
        at D:WorkspaceTestExercisevueDemovue-module
    ode_moduleslast-call-webpack-pluginindex.js:139:8
        at arrayEach (D:WorkspaceTestExercisevueDemovue-module
    ode_moduleslodash\_arrayEach.js:15:9)
        at forEach (D:WorkspaceTestExercisevueDemovue-module
    ode_moduleslodashforEach.js:38:10)
        at LastCallWebpackPlugin.process (D:WorkspaceTestExercisevueDemovue-module
    ode_moduleslast-call-webpack-pluginindex.js:136:3)
    (node:8868) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch().
    (rejection id: 2)
    (node:8868) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
    

    错误介绍

    这个错误是执行npm run build 编译打包时候出现的报错。
    第一次看到的确很懵,告诉我这个问题件有个unkown word 有个不识别的单词,估计就是什么单词或者写错了吧。现在关键的是在dist目录下没有这个css文件。都没有文件生成。

    错误提示

    解决方法

    遇到这种情况,一个项目要是出现这种单词写错了,而且npm run dev 的时候也不报错。直接去一个文件一个文件的找肯定遭不住、所以找了很久的资料,终于看到一个大佬说修改一下webpack.prod.conf里的一段代码就可以了。然后重新打包就能打包成功。最后再到生成的css文件中去看到在多少行。再去对应的源文件里面修改。
    
    // 在webpack.prod.conf中找到这个暂时注释掉。解决问题后再放开
    //new OptimizeCSSPlugin({
    // cssProcessorOptions: config.build.productionSourceMap
    //? { safe: true, map: { inline: false } }
    // : { safe: true }
    //}),
    

    最后解决问题后。及得把注释放开。我的问题是在样式里面用了
    //注释

  • 相关阅读:
    福州KTV
    MSN登陆不上:微软谴责中国的“技术问题”
    DB2 存储过程开发最佳实践
    在DB2存储过程中返回一个数据集
    Host is not allowed to connect to this MySQL server 解决方案
    CentOS安装中文支持
    ImportError: libpq.so.5: cannot open shared object file: No such file or directory
    CentOS 终端显示中文异常解决办法
    pytestDemo
    python 获取当前运行的类名函数名
  • 原文地址:https://www.cnblogs.com/justyouadmin/p/12744704.html
Copyright © 2020-2023  润新知