Vue npm run build 错误 (node:7852) UnhandledPromiseRejectionWarning: CssSyntaxError:xxxx.Unknown word

一、首先,来看看错误提示

building for production...Error processing file: static/css/app.df86e347a94aed52aa7bb0b865b3f053.css
(node:8868) UnhandledPromiseRejectionWarning: CssSyntaxError: D:\Workspace\TestExercise\vueDemo\vue-module\static\css\app.df86e347a94aed52aa7bb0b865b3f053.css:49:45: Unknown word
    at Input.error (D:\Workspace\TestExercise\vueDemo\vue-module\node_modules\optimize-css-assets-webpack-plugin\node_modules\postcss\lib\input.js:130:16)
    at Parser.unknownWord (D:\Workspace\TestExercise\vueDemo\vue-module\node_modules\optimize-css-assets-webpack-plugin\node_modules\postcss\lib\parser.js:563:22)
    at Parser.decl (D:\Workspace\TestExercise\vueDemo\vue-module\node_modules\optimize-css-assets-webpack-plugin\node_modules\postcss\lib\parser.js:235:16)
    at Parser.other (D:\Workspace\TestExercise\vueDemo\vue-module\node_modules\optimize-css-assets-webpack-plugin\node_modules\postcss\lib\parser.js:133:18)
    at Parser.parse (D:\Workspace\TestExercise\vueDemo\vue-module\node_modules\optimize-css-assets-webpack-plugin\node_modules\postcss\lib\parser.js:77:16)
    at parse (D:\Workspace\TestExercise\vueDemo\vue-module\node_modules\optimize-css-assets-webpack-plugin\node_modules\postcss\lib\parse.js:17:12)
    at new LazyResult (D:\Workspace\TestExercise\vueDemo\vue-module\node_modules\optimize-css-assets-webpack-plugin\node_modules\postcss\lib\lazy-result.js:60:16)
    at Processor. (D:\Workspace\TestExercise\vueDemo\vue-module\node_modules\optimize-css-assets-webpack-plugin\node_modules\postcss\lib\processor.js:138:12)
    at Processor.process (D:\Workspace\TestExercise\vueDemo\vue-module\node_modules\optimize-css-assets-webpack-plugin\node_modules\postcss\lib\processor.js:117:23)
    at Function.creator.process (D:\Workspace\TestExercise\vueDemo\vue-module\node_modules\optimize-css-assets-webpack-plugin\node_modules\postcss\lib\postcss.js:148:43)
    at OptimizeCssAssetsPlugin.processCss (D:\Workspace\TestExercise\vueDemo\vue-module\node_modules\optimize-css-assets-webpack-plugin\index.js:63:19)
    at Object.processor (D:\Workspace\TestExercise\vueDemo\vue-module\node_modules\optimize-css-assets-webpack-plugin\index.js:29:23)
    at D:\Workspace\TestExercise\vueDemo\vue-module\node_modules\last-call-webpack-plugin\index.js:139:8
    at arrayEach (D:\Workspace\TestExercise\vueDemo\vue-module\node_modules\lodash\_arrayEach.js:15:9)
    at forEach (D:\Workspace\TestExercise\vueDemo\vue-module\node_modules\lodash\forEach.js:38:10)
    at LastCallWebpackPlugin.process (D:\Workspace\TestExercise\vueDemo\vue-module\node_modules\last-call-webpack-plugin\index.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.

 

1、好的,主要是后面,我的哥,它告诉了我,错误在哪一行,但是这个文件没生成,所以源码也看不到哎(衰,没事,遇到问题最重要的是,解决问题,而不是逃避...先鼓励一下自己)

Vue npm run build 错误 (node:7852) UnhandledPromiseRejectionWarning: CssSyntaxError:xxxx.Unknown word_第1张图片

 

2、找了很久资料,终于,看到一个评论中,一位大佬说注释,那就试一试,即修改文件webpack.prod.conf,参考在这里哈

Vue npm run build 错误 (node:7852) UnhandledPromiseRejectionWarning: CssSyntaxError:xxxx.Unknown word_第2张图片

 

3、ok,重新打包,看一看(期待...)

Vue npm run build 错误 (node:7852) UnhandledPromiseRejectionWarning: CssSyntaxError:xxxx.Unknown word_第3张图片

 

4、成功,注释代码好像是压缩文件,看一个解释这样说的:压缩提取出的css,并解决ExtractTextPlugin分离出的js重复问题(多个文件引入同一css文件)

Vue npm run build 错误 (node:7852) UnhandledPromiseRejectionWarning: CssSyntaxError:xxxx.Unknown word_第4张图片

 

写给自己的随笔,有问题欢迎指出( ̄. ̄)

 

 

 

 

 

 

 

 

 

 

你可能感兴趣的:(前端)