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

SyntaxError: Named export 'o' not found. The requested module './mermaid.95cd9c8e.js' is a CommonJS module #428

Closed
davidgasquez opened this issue Feb 16, 2023 · 5 comments · Fixed by #446
Assignees
Labels
bug Something isn't working Stream: App App itself i.e. functionality of template

Comments

@davidgasquez
Copy link

Hey there! I wanted to test flowershow as an Obsidian Publish replacement and I'm hitting some errors when running npx flowershow@latest preview. You can reproduce it by following the Publish tutorial. It also seems to be happening in CI.

This is the error:

   > @flowershow/template@1.0.0 export
   > npm run build && next export
   
   
   > @flowershow/template@1.0.0 prebuild
   > npm run generate
   
   
   > @flowershow/template@1.0.0 generate
   > contentlayer build && cross-env NODE_OPTIONS="--experimental-json-modules --experimental-modules" node ./scripts/search.mjs
   
   ConfigReadError {
     error: file:///tmp/tmp.WuO12pd1pW/.flowershow/node_modules/mermaid/dist/mermaid.core.mjs:2
     import { o } from "./mermaid.95cd9c8e.js";
              ^
     SyntaxError: Named export 'o' not found. The requested module './mermaid.95cd9c8e.js' is a CommonJS module, which may not support all module.exports as named exports.
     CommonJS modules can always be imported via the default export, for example using:
   
     import pkg from './mermaid.95cd9c8e.js';
     const { o } = pkg;
   
         at ModuleJob._instantiate (node:internal/modules/esm/module_job:123:21)
         at ModuleJob.run (node:internal/modules/esm/module_job:189:5)
         at async Promise.all (index 0)
         at ESMLoader.import (node:internal/modules/esm/loader:530:24),
     configPath: '/tmp/tmp.WuO12pd1pW/.flowershow/contentlayer.config.ts',
     _tag: 'ConfigReadError',
     toString: [Function (anonymous)],
     [Symbol()]: {
       error: file:///tmp/tmp.WuO12pd1pW/.flowershow/node_modules/mermaid/dist/mermaid.core.mjs:2
       import { o } from "./mermaid.95cd9c8e.js";
                ^
     SyntaxError: Named export 'o' not found. The requested module './mermaid.95cd9c8e.js' is a CommonJS module, which may not support all module.exports as named exports.
     CommonJS modules can always be imported via the default export, for example using:
 
     import pkg from './mermaid.95cd9c8e.js';
     const { o } = pkg;
 
         at ModuleJob._instantiate (node:internal/modules/esm/module_job:123:21)
         at ModuleJob.run (node:internal/modules/esm/module_job:189:5)
         at async Promise.all (index 0)
         at ESMLoader.import (node:internal/modules/esm/loader:530:24),
     configPath: '/tmp/tmp.WuO12pd1pW/.flowershow/contentlayer.config.ts'
   },
   [Symbol()]: [ 'configPath', 'error' ]
 }
 
 -- assertion failed --
 expression : [ -d .flowershow/out ]
   --
@olayway
Copy link
Member

olayway commented Feb 16, 2023

@davidgasquez thank you for reporting this! I'll fix it today.

@olayway olayway added bug Something isn't working Stream: App App itself i.e. functionality of template labels Feb 16, 2023
@olayway olayway self-assigned this Feb 16, 2023
@olayway olayway moved this from 🆕 New to 🔖 Ready in Flowershow Backlog Feb 16, 2023
@olayway olayway moved this from 🔖 Ready to 🏗 In progress in Flowershow Backlog Feb 16, 2023
@olayway olayway changed the title Can't run flowershow SyntaxError: Named export 'o' not found. The requested module './mermaid.95cd9c8e.js' is a CommonJS module Feb 16, 2023
@olayway
Copy link
Member

olayway commented Feb 16, 2023

Most probably this is an issue with mermaid version 9.4.0. I've created an issue in their repo:
mermaid-js/mermaid#4100

A temporary solution is to force version 9.3.0 to be installed in the template. Pushed to main: 761cad2
I'm marking this issue as blocked until we hear back from mermaid team.

@olayway
Copy link
Member

olayway commented Feb 16, 2023

@davidgasquez please give it a try once again and let me know if the fix worked and if I'll have a free weekend 😅

@olayway olayway moved this from 🏗 In progress to ⛔ Blocked in Flowershow Backlog Feb 16, 2023
@lapo-luchini
Copy link

This update solved the issue for me!

% npx flowershow install
% npx flowershow build
[…]
●  (SSG)     automatically generated as static HTML + JSON (uses getStaticProps)

@davidgasquez
Copy link
Author

It works! 🎉 Thanks @olayway for taking care of this one so quickly. Love the project!

khalilcodes added a commit that referenced this issue Feb 28, 2023
khalilcodes added a commit that referenced this issue Mar 1, 2023
khalilcodes added a commit that referenced this issue Mar 1, 2023
khalilcodes added a commit that referenced this issue Mar 1, 2023
khalilcodes added a commit that referenced this issue Mar 1, 2023
Update mermaid

closes #428 

* Update mermaid in core `v10.0.1-rc.2`
* create mermaid component in core
* add `mdx-mermaid` plugin and mermaid component in template
* remove `remark-code-extra` plugin
@github-project-automation github-project-automation bot moved this from ⛔ Blocked to ✅ Done in Flowershow Backlog Mar 1, 2023
rufuspollock pushed a commit to rufuspollock/flowershow that referenced this issue Oct 27, 2023
rufuspollock pushed a commit to rufuspollock/flowershow that referenced this issue Oct 27, 2023
olayway pushed a commit that referenced this issue Oct 31, 2023
olayway pushed a commit that referenced this issue Oct 31, 2023
olayway pushed a commit that referenced this issue Oct 31, 2023
olayway pushed a commit that referenced this issue Oct 31, 2023
Update mermaid

closes #428 

* Update mermaid in core `v10.0.1-rc.2`
* create mermaid component in core
* add `mdx-mermaid` plugin and mermaid component in template
* remove `remark-code-extra` plugin
olayway pushed a commit that referenced this issue Oct 31, 2023
olayway pushed a commit that referenced this issue Oct 31, 2023
olayway pushed a commit that referenced this issue Oct 31, 2023
olayway pushed a commit that referenced this issue Oct 31, 2023
Update mermaid

closes #428 

* Update mermaid in core `v10.0.1-rc.2`
* create mermaid component in core
* add `mdx-mermaid` plugin and mermaid component in template
* remove `remark-code-extra` plugin
olayway pushed a commit that referenced this issue Oct 31, 2023
olayway pushed a commit that referenced this issue Oct 31, 2023
olayway pushed a commit that referenced this issue Oct 31, 2023
olayway pushed a commit that referenced this issue Oct 31, 2023
Update mermaid

closes #428 

* Update mermaid in core `v10.0.1-rc.2`
* create mermaid component in core
* add `mdx-mermaid` plugin and mermaid component in template
* remove `remark-code-extra` plugin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Stream: App App itself i.e. functionality of template
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants