Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
greghesp opened this issue May 28, 2020 · 2 comments · Fixed by #2829
Closed

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

greghesp opened this issue May 28, 2020 · 2 comments · Fixed by #2829
Labels
bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers

Comments

@greghesp
Copy link

🐛 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
@greghesp greghesp added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels May 28, 2020
@lex111
Copy link
Contributor

lex111 commented May 28, 2020

Please read the release notes carefully. https://github.com/facebook/docusaurus/releases/tag/v2.0.0-alpha.56

@SamChou19815
Copy link
Contributor

SamChou19815 commented May 28, 2020

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
Labels
bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants