Skip to content

Import error #2345

Closed
Closed
@jpage-godaddy

Description

@jpage-godaddy

Bug Report

docsify-server-renderer does not declare strip-indent as a dependency. Thus, if the install tree has other versions of strip-indent, like version 4.0.0, we get this error:

var stripIndent = _interopDefault(require('strip-indent'));
                                  ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /home/jpage/Code/<myrepo>/node_modules/strip-indent/index.js from /home/jpage/Code/<myrepo>/node_modules/docsify-server-renderer/build.js not supported.
Instead change the require of index.js in /home/jpage/Code/<myrepo>/node_modules/docsify-server-renderer/build.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/home/jpage/Code/<myrepo>/node_modules/docsify-server-renderer/build.js:13:35)
    at Object.<anonymous> (/home/jpage/Code/<myrepo>/node_modules/docsify-cli/lib/commands/start.js:5:18)
    at Object.<anonymous> (/home/jpage/Code/<myrepo>/node_modules/docsify-cli/lib/index.js:4:10)
    at Object.<anonymous> (/home/jpage/Code/<myrepo>/node_modules/docsify-cli/bin/docsify:8:13) {
  code: 'ERR_REQUIRE_ESM'
}

Steps to reproduce

  1. Install docsify-cli in a project that has strip-indent@^4.0.0 installed to the top of node_modules.
  2. Run docsify init

Current behaviour

The above runtime error occurs

Expected behaviour

No error. docsify-server-renderer should install strip-indent@3 nested under its own node_modules so that it requires the correct version of that dependency.

Other relevant information

  • Docsify version: 4.13.1
  • Bug still occurs when all/other plugins are disabled?

  • Docsify plugins (if the bug happens when plugins enabled, please try to isolate the issue):

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions