【问题标题】:Vuepress build failed after migrating from 0.X to 1.2.0从 0.X 迁移到 1.2.0 后,Vuepress 构建失败
【发布时间】:2020-04-19 17:31:20
【问题描述】:

我遵循了 vuepress 网站上的官方升级指南。 https://vuepress.vuejs.org/miscellaneous/migration-guide.html

当我运行 yarn docs:dev 时,我得到了这个输出:

tip Apply theme @vuepress/theme-default ...
tip Apply plugin container (i.e. "vuepress-plugin-container") ...
tip Apply plugin @vuepress/last-updated (i.e. "@vuepress/plugin-last-updated") ...
tip Apply plugin @vuepress/register-components (i.e. "@vuepress/plugin-register-components") ...
tip Apply plugin @vuepress/active-header-links (i.e. "@vuepress/plugin-active-header-links") ...
tip Apply plugin @vuepress/search (i.e. "@vuepress/plugin-search") ...
tip Apply plugin @vuepress/nprogress (i.e. "@vuepress/plugin-nprogress") ...
tip Apply plugin @vuepress/pwa (i.e. "@vuepress/plugin-pwa") ...
tip Apply plugin vuepress-plugin-anonymous-3d39fa1d ...

* Client █████████████████████████ building (42%) 271/275 modules 4 active
 node_modules\lodash\_root.js

i 「wds」: Project is running at http://0.0.0.0:8080/
i 「wds」: webpack output is served from /docs/
i 「wds」: Content not from webpack is served from c:\dsasd\docs\.vuepress\public
i 「wds」: 404s will fallback to /index.html
Language does not exist bat

当我在浏览器中打开 8080 端口时,它会显示一堆错误。

当我运行 yarn docs:build 时,我得到了这个输出:

Error: Failed to compile with errors.
    at webpack (c:\dsasd\node_modules\@vuepress\core\lib\node\build\index.js:186:16)
    at finalCallback (c:\dsasd\node_modules\@vuepress\core\node_modules\webpack\lib\MultiCompiler.js:254:12)
    at runWithDependencies.err (c:\dsasd\node_modules\@vuepress\core\node_modules\webpack\lib\MultiCompiler.js:277:6)
    at done (c:\dsasd\node_modules\neo-async\async.js:2931:13)
    at runCompilers (c:\dsasd\node_modules\@vuepress\core\node_modules\webpack\lib\MultiCompiler.js:181:48)
    at err (c:\dsasd\node_modules\@vuepress\core\node_modules\webpack\lib\MultiCompiler.js:188:7)
    at compiler.run (c:\dsasd\node_modules\@vuepress\core\node_modules\webpack\lib\MultiCompiler.js:270:7)
    at finalCallback (c:\dsasd\node_modules\@vuepress\core\node_modules\webpack\lib\Compiler.js:257:39)
    at hooks.done.callAsync.err (c:\dsasd\node_modules\@vuepress\core\node_modules\webpack\lib\Compiler.js:273:13)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (c:\dsasd\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:33:1)  
    at AsyncSeriesHook.lazyCompileHook (c:\dsasd\node_modules\tapable\lib\Hook.js:154:20)
    at onCompiled (c:\dsasd\node_modules\@vuepress\core\node_modules\webpack\lib\Compiler.js:271:21)
    at hooks.afterCompile.callAsync.err (c:\dsasd\node_modules\@vuepress\core\node_modules\webpack\lib\Compiler.js:681:15)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (c:\dsasd\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)   
    at AsyncSeriesHook.lazyCompileHook (c:\dsasd\node_modules\tapable\lib\Hook.js:154:20)
    at compilation.seal.err (c:\dsasd\node_modules\@vuepress\core\node_modules\webpack\lib\Compiler.js:678:31)
error Command failed with exit code 1.

有什么解决办法或建议吗?

【问题讨论】:

  • 你能分享更多关于你的项目的细节吗?也许是回购?仅从您的日志很难判断

标签: webpack yarnpkg vuepress


【解决方案1】:

好吧,我认为您的依赖存在冲突导致错误。删除package.json 中除vuepress 之外的所有依赖项,重新安装所有依赖项,错误消失。我对此并不熟悉,但我认为这可能是core-js 的版本控制有问题,vuepress 仍在使用 2.x 而您正在使用 3.x

迁移到vuepress的另一个问题1.2.0是一些官方插件默认不附带vuepress。所以需要手动安装vuepress-plugin-pwa才能使用。查看document了解更多详情。

顺便说一句,我注意到你的仓库中有package-lock.jsonyarn.lock,所以我不确定你使用的是哪个工具。目前推荐使用yarn,因为npm在某些情况下可能会导致一些错误。

【讨论】:

  • 是的,这是真的。 Vuepress 仍在使用 core-js beta,这给了我安全错误。
猜你喜欢
  • 2022-12-30
  • 2019-12-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-04-09
  • 1970-01-01
  • 2020-09-07
相关资源
最近更新 更多