vue项目能正常启动但是打包报错

发布时间:2024年01月22日

项目执行npm run serve/dev的图一点影响没有 跑起来之后页面也非常的正常

然后就来到了打包环境 执行打包命令

报这种错误

?- htmlparser.js:255 HTMLParser.parse
? ? [mydemo]/[html-minifier-terser]/src/htmlparser.js:255:15
??
? - runMicrotasks
??
? - task_queues.js:95 processTicksAndRejections
? ? internal/process/task_queues.js:95:5
??
? - htmlminifier.js:1282 async minify
? ? [mydemo]/[html-minifier-terser]/src/htmlminifier.js:1282:3

? - htmlminifier.js:1365 async Object.exports.minify
? ? [mydemo]/[html-minifier-terser]/src/htmlminifier.js:1365:16

Failed to compile with 1 error                                                                                                                                                                  下午1:16:56

  Error: Parse Error: <meta http-equiv="X-UA-Compatible" content="IE=edge"
      <meta name="viewport" content="width=device-width,initial-scale=1.0">
      <link rel="icon" href="/favicon.ico">
      <title>mydemo</title>
    <script defer src="/js/chunk-vendors.7fb67861.js"></script><script defer src="/js/app.3a9203cb.js"></script><link href="/css/chunk-vendors.ab49d789.css" rel="stylesheet"><link href="/css/app.a6c53255.css" re  l="stylesheet"></head>
    <body>
      <noscript>
        <strong>We're sorry but mydemo doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
      </noscript>
      <div id="app"></div>
      <!-- built files will be auto injected -->
    </body>
  </html>
  
  - htmlparser.js:255 HTMLParser.parse
    [mydemo]/[html-minifier-terser]/src/htmlparser.js:255:15
  
  - runMicrotasks
  
  - task_queues.js:95 processTicksAndRejections
    internal/process/task_queues.js:95:5
  
  - htmlminifier.js:1282 async minify
    [mydemo]/[html-minifier-terser]/src/htmlminifier.js:1282:3

  - htmlminifier.js:1365 async Object.exports.minify
    [mydemo]/[html-minifier-terser]/src/htmlminifier.js:1365:16


 ERROR  Error: Build failed with errors.
Error: Build failed with errors.
    at D:\test\tdemo\mydemo\node_modules\@vue\cli-service\lib\commands\build\index.js:207:23
    at D:\test\tdemo\mydemo\node_modules\webpack\lib\webpack.js:148:8
    at D:\test\tdemo\mydemo\node_modules\webpack\lib\HookWebpackError.js:68:3
    at Hook.eval [as callAsync] (eval at create (D:\test\tdemo\mydemo\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (D:\test\tdemo\mydemo\node_modules\tapable\lib\Hook.js:18:14)
    at Cache.shutdown (D:\test\tdemo\mydemo\node_modules\webpack\lib\Cache.js:150:23)
    at D:\test\tdemo\mydemo\node_modules\webpack\lib\Compiler.js:1225:15
    at Hook.eval [as callAsync] (eval at create (D:\test\tdemo\mydemo\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (D:\test\tdemo\mydemo\node_modules\tapable\lib\Hook.js:18:14)
    at Compiler.close (D:\test\tdemo\mydemo\node_modules\webpack\lib\Compiler.js:1218:23)
    at D:\test\tdemo\mydemo\node_modules\webpack\lib\webpack.js:147:16
    at finalCallback (D:\test\tdemo\mydemo\node_modules\webpack\lib\Compiler.js:441:32)
    at D:\test\tdemo\mydemo\node_modules\webpack\lib\Compiler.js:458:13
    at Hook.eval [as callAsync] (eval at create (D:\test\tdemo\mydemo\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:24:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (D:\test\tdemo\mydemo\node_modules\tapable\lib\Hook.js:18:14)
    at onCompiled (D:\test\tdemo\mydemo\node_modules\webpack\lib\Compiler.js:456:21)
    at D:\test\tdemo\mydemo\node_modules\webpack\lib\Compiler.js:1196:17
    at Hook.eval [as callAsync] (eval at create (D:\test\tdemo\mydemo\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (D:\test\tdemo\mydemo\node_modules\tapable\lib\Hook.js:18:14)
    at D:\test\tdemo\mydemo\node_modules\webpack\lib\Compiler.js:1192:33
    at finalCallback (D:\test\tdemo\mydemo\node_modules\webpack\lib\Compilation.js:2787:11)
    at D:\test\tdemo\mydemo\node_modules\webpack\lib\Compilation.js:3092:11
    at Hook.eval [as callAsync] (eval at create (D:\test\tdemo\mydemo\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (D:\test\tdemo\mydemo\node_modules\tapable\lib\Hook.js:18:14)
    at D:\test\tdemo\mydemo\node_modules\webpack\lib\Compilation.js:3085:38
    at eval (eval at create (D:\test\tdemo\mydemo\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:15:1)
    at eval (eval at create (D:\test\tdemo\mydemo\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:14:1)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mydemo@0.1.0 build: `vue-cli-service build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mydemo@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

这个错怎么说呢 一般是不会发生的 发生这个错误的原因也非常的抽象 是手误的原因。public文件夹下的index.html文件 问题就出在这里 解析东西 插入东西发生了失败。能正常的跑应该是浏览器或者跑的那个服务有个校准或者忽略的功能 但是打包的确没有

?图上是页面注意看框起来的 不小心删了一个结束标签 引发了这一系列的错误 补上就能解决这个报错。

文章来源:https://blog.csdn.net/qq_44428688/article/details/135745770
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。