eFrane / vuepress-plugin-mermaidjs

Vuepress plugin for mermaid.js diagrams
https://vuepress-plugin-mermaidjs.efrane.com
73 stars 21 forks source link

`vuepress build docs` can not work. (undefined) ./node_modules/mermaid/dist/mermaid.min.js #173

Open dingyuqi opened 2 months ago

dingyuqi commented 2 months ago

I ran npm install --save-dev vuepress-plugin-mermaidjs to install plugin-mermaidjs. My config.js is below:

module.exports = {
    markdown: {
        extractHeaders: ['h2', 'h3', 'h4', 'h5', 'h6'],
        lineNumbers: true,
    },
    plugins: {
        'one-click-copy': {
            copySelector: ['div[class*="language-"] pre', 'div[class*="aside-code"] aside'],
            copyMessage: 'Copied successfully!',
            toolTipMessage: 'Copy to clipboard',
            duration: 300,
        },
        'vuepress-plugin-mathjax': {
            packages: ['algorithm', 'algorithmic', 'base', 'ams'],
            showError: true,
            target: 'svg',

        },
        'vuepress-plugin-element-tabs': {},
        'vuepress-plugin-mermaidjs': {},
    }
};

I ran vuepress build docs in git bash and I had this problem:

tip Apply plugin @vuepress/search (i.e. "@vuepress/plugin-search") ...
tip Apply plugin @vuepress/nprogress (i.e. "@vuepress/plugin-nprogress") ...
tip Apply plugin one-click-copy (i.e. "vuepress-plugin-one-click-copy") ...
tip Apply plugin @vssue/vssue (i.e. "@vssue/vuepress-plugin-vssue") ...
tip Apply plugin mathjax (i.e. "vuepress-plugin-mathjax") ...
tip Apply plugin element-tabs (i.e. "vuepress-plugin-element-tabs") ...
tip Apply plugin md-enhance (i.e. "vuepress-plugin-md-enhance") ...
tip Apply plugin mermaidjs (i.e. "vuepress-plugin-mermaidjs") ...
i Compiling Client
i Compiling Server
√ Server: Compiled with some errors in 14.08s
√ Client: Compiled with some errors in 18.84s
(undefined) ./node_modules/mermaid/dist/mermaid.min.js 6:13181
Module parse failed: Unexpected token (6:13181)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)
 @ ./node_modules/vuepress-plugin-mermaidjs/src/mermaid.js 43:4-38
 @ ./node_modules/@vuepress/core/.temp/app-enhancers/7.js
 @ ./node_modules/@vuepress/core/.temp/internal/app-enhancers.js
 @ ./node_modules/@vuepress/core/lib/client/app.js
 @ ./node_modules/@vuepress/core/lib/client/clientEntry.js
 @ multi ./node_modules/@vuepress/core/lib/client/clientEntry.js
(undefined) ./node_modules/mermaid/dist/mermaid.min.js 6:13181
Module parse failed: Unexpected token (6:13181)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)
 @ ./node_modules/vuepress-plugin-mermaidjs/src/mermaid.js 43:4-38
 @ ./node_modules/@vuepress/core/.temp/app-enhancers/7.js
 @ ./node_modules/@vuepress/core/.temp/internal/app-enhancers.js
 @ ./node_modules/@vuepress/core/lib/client/app.js
 @ ./node_modules/@vuepress/core/lib/client/serverEntry.js
 @ multi ./node_modules/@vuepress/core/lib/client/serverEntry.js
Error: Failed to compile with errors.
    at D:\dyqProjects\blog\node_modules\@vuepress\core\lib\node\build\index.js:190:16
    at finalCallback (D:\dyqProjects\blog\node_modules\webpack\lib\MultiCompiler.js:254:12)
    at D:\dyqProjects\blog\node_modules\webpack\lib\MultiCompiler.js:277:6
    at done (D:\dyqProjects\blog\node_modules\neo-async\async.js:2931:13)
    at runCompilers (D:\dyqProjects\blog\node_modules\webpack\lib\MultiCompiler.js:181:48)
    at D:\dyqProjects\blog\node_modules\webpack\lib\MultiCompiler.js:188:7
    at D:\dyqProjects\blog\node_modules\webpack\lib\MultiCompiler.js:270:7
    at finalCallback (D:\dyqProjects\blog\node_modules\webpack\lib\Compiler.js:257:39)
    at D:\dyqProjects\blog\node_modules\webpack\lib\Compiler.js:273:13
    at AsyncSeriesHook.eval [as callAsync] (eval at create (D:\dyqProjects\blog\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:33:1)
    at AsyncSeriesHook.lazyCompileHook (D:\dyqProjects\blog\node_modules\tapable\lib\Hook.js:154:20)
    at onCompiled (D:\dyqProjects\blog\node_modules\webpack\lib\Compiler.js:271:21)
    at D:\dyqProjects\blog\node_modules\webpack\lib\Compiler.js:681:15
    at AsyncSeriesHook.eval [as callAsync] (eval at create (D:\dyqProjects\blog\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (D:\dyqProjects\blog\node_modules\tapable\lib\Hook.js:154:20)
    at D:\dyqProjects\blog\node_modules\webpack\lib\Compiler.js:678:31
    at AsyncSeriesHook.eval [as callAsync] (eval at create (D:\dyqProjects\blog\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:9:1)
    at AsyncSeriesHook.lazyCompileHook (D:\dyqProjects\blog\node_modules\tapable\lib\Hook.js:154:20)
    at D:\dyqProjects\blog\node_modules\webpack\lib\Compilation.js:1423:35
    at AsyncSeriesHook.eval [as callAsync] (eval at create (D:\dyqProjects\blog\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:9:1)
    at AsyncSeriesHook.lazyCompileHook (D:\dyqProjects\blog\node_modules\tapable\lib\Hook.js:154:20)
    at D:\dyqProjects\blog\node_modules\webpack\lib\Compilation.js:1414:32
    at eval (eval at create (D:\dyqProjects\blog\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:17:1)
    at D:\dyqProjects\blog\node_modules\terser-webpack-plugin\dist\index.js:321:9
    at step (D:\dyqProjects\blog\node_modules\terser-webpack-plugin\dist\TaskRunner.js:87:9)
    at done (D:\dyqProjects\blog\node_modules\terser-webpack-plugin\dist\TaskRunner.js:98:30)
    at tryCatcher (D:\dyqProjects\blog\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (D:\dyqProjects\blog\node_modules\bluebird\js\release\promise.js:547:31)
    at Promise._settlePromise (D:\dyqProjects\blog\node_modules\bluebird\js\release\promise.js:604:18)
    at Promise._settlePromise0 (D:\dyqProjects\blog\node_modules\bluebird\js\release\promise.js:649:10)
    at Promise._settlePromises (D:\dyqProjects\blog\node_modules\bluebird\js\release\promise.js:729:18)
    at Promise._fulfill (D:\dyqProjects\blog\node_modules\bluebird\js\release\promise.js:673:18)
    at Promise._resolveCallback (D:\dyqProjects\blog\node_modules\bluebird\js\release\promise.js:466:57)
    at Promise._settlePromiseFromHandler (D:\dyqProjects\blog\node_modules\bluebird\js\release\promise.js:559:17)
    at Promise._settlePromise (D:\dyqProjects\blog\node_modules\bluebird\js\release\promise.js:604:18)
    at Promise._settlePromise0 (D:\dyqProjects\blog\node_modules\bluebird\js\release\promise.js:649:10)
    at Promise._settlePromises (D:\dyqProjects\blog\node_modules\bluebird\js\release\promise.js:729:18)
    at Promise._fulfill (D:\dyqProjects\blog\node_modules\bluebird\js\release\promise.js:673:18)
    at Promise._resolveCallback (D:\dyqProjects\blog\node_modules\bluebird\js\release\promise.js:466:57)
    at Promise._settlePromiseFromHandler (D:\dyqProjects\blog\node_modules\bluebird\js\release\promise.js:559:17)
    at Promise._settlePromise (D:\dyqProjects\blog\node_modules\bluebird\js\release\promise.js:604:18)
    at Promise._settlePromise0 (D:\dyqProjects\blog\node_modules\bluebird\js\release\promise.js:649:10)
    at Promise._settlePromises (D:\dyqProjects\blog\node_modules\bluebird\js\release\promise.js:729:18)
    at Promise._fulfill (D:\dyqProjects\blog\node_modules\bluebird\js\release\promise.js:673:18)
    at Promise._settlePromise (D:\dyqProjects\blog\node_modules\bluebird\js\release\promise.js:617:21)
    at Promise._settlePromise0 (D:\dyqProjects\blog\node_modules\bluebird\js\release\promise.js:649:10)
    at Promise._settlePromises (D:\dyqProjects\blog\node_modules\bluebird\js\release\promise.js:729:18)
    at Promise._fulfill (D:\dyqProjects\blog\node_modules\bluebird\js\release\promise.js:673:18)
    at Promise._resolveCallback (D:\dyqProjects\blog\node_modules\bluebird\js\release\promise.js:489:14)
    at Promise._settlePromiseFromHandler (D:\dyqProjects\blog\node_modules\bluebird\js\release\promise.js:559:17)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! myblog@1.0.0 build: `vuepress build docs`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myblog@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

vuepress version is :

$ vuepress -v
cli.js/1.9.10 win32-x64 node-v14.16.1