vue npm run build 报错
| building for production...Error processing file: static/css/app.6f7f38b3dcc243bbf8b8f261017a6621.css
(node:14996) UnhandledPromiseRejectionWarning: CssSyntaxError: E:work objectsignVuestaticcssapp.6f7f38b3dcc243bbf8b8f261017a6621.css:1116:8: Unknown word
at Input.error (E:work objectsignVue
ode_modules\_postcss@7.0.27@postcsslibinput.js:130:16)
at Parser.unknownWord (E:work objectsignVue
ode_modules\_postcss@7.0.27@postcsslibparser.js:563:22)
at Parser.decl (E:work objectsignVue
ode_modules\_postcss@7.0.27@postcsslibparser.js:235:16)
at Parser.other (E:work objectsignVue
ode_modules\_postcss@7.0.27@postcsslibparser.js:133:18)
at Parser.parse (E:work objectsignVue
ode_modules\_postcss@7.0.27@postcsslibparser.js:77:16)
at parse (E:work objectsignVue
ode_modules\_postcss@7.0.27@postcsslibparse.js:17:12)
at new LazyResult (E:work objectsignVue
ode_modules\_postcss@7.0.27@postcssliblazy-result.js:60:16)
at Processor.<anonymous> (E:work objectsignVue
ode_modules\_postcss@7.0.27@postcsslibprocessor.js:138:12)
at Processor.process (E:work objectsignVue
ode_modules\_postcss@7.0.27@postcsslibprocessor.js:117:23)
at Function.creator.process (E:work objectsignVue
ode_modules\_postcss@7.0.27@postcsslibpostcss.js:148:43)
at OptimizeCssAssetsPlugin.processCss (E:work objectsignVue
ode_modules\_optimize-css-assets-webpack-plugin@3.2.1@optimize-css-assets-webpack-pluginindex.js:63:19)
at Object.processor (E:work objectsignVue
ode_modules\_optimize-css-assets-webpack-plugin@3.2.1@optimize-css-assets-webpack-pluginindex.js:29:23)
at E:work objectsignVue
ode_modules\_last-call-webpack-plugin@2.1.2@last-call-webpack-pluginindex.js:139:8
at arrayEach (E:work objectsignVue
ode_modules\_lodash@4.17.15@lodash\_arrayEach.js:15:9)
at forEach (E:work objectsignVue
ode_modules\_lodash@4.17.15@lodashforEach.js:38:10)
at LastCallWebpackPlugin.process (E:work objectsignVue
ode_modules\_last-call-webpack-plugin@2.1.2@last-call-webpack-pluginindex.js:136:3)
(node:14996) 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:14996) [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.
一、报错内容
building for production…Error processing file: static/css/app.文件id.css
(node:1700) UnhandledPromiseRejectionWarning: CssSyntaxError: E:项目路径staticcssapp.a8071d931d4fde333adb984da7273dc6.css:136:3: Unknown word
二、报错原因
仔细读了终端打印出的所有内容,仍然没有发现任何有效的提示,也没找到出现问题的文件所在路径。唯一的理解可能就是Unknow word表示构建项目时不知道// 我的注释是什么东西吧,最终发现是在vue组件或者css文件中使用了//(如下)的注释方式:
三、解决方法
删除所有vue组件、css文件中的这种注释
采用/* 这是我的注释 */ 方式来注释备注内容。
https://blog.csdn.net/CSDN_X_W/article/details/104655805
这个问题 我百度了很久 网上没有明确的答案,导致浪费了大量的时间 后面看到一篇文章说这个是css的问题 于是想到了解决方案
把引入的css文件先全部注释 排除法 先确定是哪个文件导致的报错 然后再更具体地定位
总结: 当碰到的bug 不确定很模糊的时候 首先要确定问题的大概是什么 这样才有思路 去解决 而不是盲目去猜,解决问题架子,也就是:问题-原因-解决方案
Module build failed: Error: Missing binding E:ethernet-dapp-app
ode_modulesnode-sassvendorwin32-x64-72inding.node
Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 12.x
Found bindings for the following environments:
- Windows 64-bit with Node.js 12.x
This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass` to download the binding for your current environment.
at module.exports (E:ethernet-dapp-app
ode_modules
ode-sasslibinding.js:15:13)
at Object.<anonymous> (E:ethernet-dapp-app
ode_modules
ode-sasslibindex.js:14:35)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Module.require (internal/modules/cjs/loader.js:852:19)
at require (internal/modules/cjs/helpers.js:74:18)
at getDefaultSassImpl (E:ethernet-dapp-app
ode_modulessass-loaderdistindex.js:198:10)
at Object.loader (E:ethernet-dapp-app
ode_modulessass-loaderdistindex.js:80:29)
Module build failed: Error: Missing binding C:UsersAdministratorDesktop新建文件夹mall
ode_modules
ode-sassvendorwin32-x64-64inding.node
解决办法:npm i node-sass