Skip to content

Error: Cannot find module '@docusaurus/plugin-ideal-image' #2825

Closed

Description

@greghesp

🐛 Bug Report

I am trying to use the plugin-ideal-image plugin, however despite installing and configuring, it throws an error to say it cannot find it. I can confirm that the plugin exists in my node_modules

Have you read the Contributing Guidelines on issues?

Yes

To Reproduce

  1. Install plugin-ideal-image with npm i --save @docusaurus/plugin-ideal-image. This adds the dependency "@docusaurus/plugin-ideal-image": "^2.0.0-alpha.39",

  2. Add the plugin to my docusaurus.config.js file:
    plugins: ['@docusaurus/plugin-ideal-image'],

  3. Import the plugin and use in my mdx file:

import Image from '@theme/IdealImage';
<Image img={require('./img.png')} />
  1. npm run start

Expected behavior

Image is loaded and displayed in documentation

Actual Behavior

Docusaurus fails to start with the below error:

Error: Cannot find module '@docusaurus/plugin-ideal-image'
Require stack:
- C:\Users\Greg\Documents\Projects\assistant-relay\doc-src\website
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
    at Function.resolve (internal/modules/cjs/helpers.js:78:19)
    at C:\Users\Greg\Documents\Projects\assistant-relay\doc-src\website\node_modules\@docusaurus\core\lib\server\plugins\init.js:40:67
    at Array.map (<anonymous>)
    at Object.initPlugins (C:\Users\Greg\Documents\Projects\assistant-relay\doc-src\website\node_modules\@docusaurus\core\lib\server\plugins\init.js:22:10)
    at Object.loadPlugins (C:\Users\Greg\Documents\Projects\assistant-relay\doc-src\website\node_modules\@docusaurus\core\lib\server\plugins\index.js:47:28)
    at Object.load (C:\Users\Greg\Documents\Projects\assistant-relay\doc-src\website\node_modules\@docusaurus\core\lib\server\index.js:57:62)
    at start (C:\Users\Greg\Documents\Projects\assistant-relay\doc-src\website\node_modules\@docusaurus\core\lib\commands\start.js:45:34)
    at C:\Users\Greg\Documents\Projects\assistant-relay\doc-src\website\node_modules\@docusaurus\core\bin\docusaurus.js:29:5
    at Command.<anonymous> (C:\Users\Greg\Documents\Projects\assistant-relay\doc-src\website\node_modules\@docusaurus\core\bin\docusaurus.js:97:23)
    at Command.listener (C:\Users\Greg\Documents\Projects\assistant-relay\doc-src\website\node_modules\commander\index.js:370:29)
    at Command.emit (events.js:315:20)
    at Command.parseArgs (C:\Users\Greg\Documents\Projects\assistant-relay\doc-src\website\node_modules\commander\index.js:892:12)
    at Command.parse (C:\Users\Greg\Documents\Projects\assistant-relay\doc-src\website\node_modules\commander\index.js:642:21)
    at Object.<anonymous> (C:\Users\Greg\Documents\Projects\assistant-relay\doc-src\website\node_modules\@docusaurus\core\bin\docusaurus.js:120:5)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)

Your Environment

  • Docusaurus version used: 2.0.0-alpha.56
  • Environment name and version (e.g. Chrome 78.0.3904.108, Node.js 10.17.0): Node 12.17.0
  • Operating system and version (desktop or mobile): Windows 10 x64

Activity

  1. added
    bug
    status: needs triage
    on May 28, 2020
  2. SamChou19815 commented on May 28, 2020

    @SamChou19815
    Contributor

    I think the real issue here is that you are using an old @docusaurus/plugin-ideal-image. The latest should be alpha-56.

    I am able to reproduce this problem. Working on a fix now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugstatus: needs triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions