从0.X迁移到1.2.0后,Vuepress构建失败

问题描述 投票:0回答:1

我遵循了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 yarn vuepress
1个回答
0
投票

嗯,我认为您的依赖项中有一个冲突会导致错误。删除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在某些情况下可能会导致一些错误。

© www.soinside.com 2019 - 2024. All rights reserved.