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

bug(nuxt-content): could not load file mdc-imports.mjs #70

Open
miclgael opened this issue Sep 29, 2023 · 5 comments
Open

bug(nuxt-content): could not load file mdc-imports.mjs #70

miclgael opened this issue Sep 29, 2023 · 5 comments

Comments

@miclgael
Copy link

miclgael commented Sep 29, 2023

Hello, and thank you for taking initiative in this module!

My set-up includes Nuxt Content, and produces this error on macOS 12.2.1 (21D62) Monterey

ℹ Building Nitro Server (preset: node-server)                                                             nitro 8:31:53 am

[nitro 8:31:57 am]  ERROR  Error: Could not load file:///Users/<REDACTED>/Code/projects/<REDACTED>/.nuxt/mdc-imports.mjs (imported by node_modules/.pnpm/@nuxtjs+mdc@0.2.1/node_modules/@nuxtjs/mdc/dist/runtime/parser/index.mjs): ENOENT: no such file or directory, open 'file:///Users/<REDACTED>/Code/projects/<REDACTED>/.nuxt/mdc-imports.mjs'


undefined

Error: Error: Could not load file://./.nuxt/mdc-imports.mjs (imported by node_modules/.pnpm/@nuxtjs+mdc@0.2.1/node_modules/@nuxtjs/mdc/dist/runtime/parser/index.mjs): ENOENT: no such file or directory, open 'file://./.nuxt/mdc-imports.mjs'
    at defineNuxtConfig (./node_modules/.pnpm/@storybook-vue+nuxt@0.1.5_@types+node@18.18.1_@vue+compiler-core@3.3.4_eslint@8.50.0_nuxt@3.7_q6xcmcxyhuuik33x6btbuqlzni/node_modules/@storybook-vue/nuxt/dist/preset.cjs:79:11)
    at async Object.viteFinal (./node_modules/.pnpm/@storybook-vue+nuxt@0.1.5_@types+node@18.18.1_@vue+compiler-core@3.3.4_eslint@8.50.0_nuxt@3.7_q6xcmcxyhuuik33x6btbuqlzni/node_modules/@storybook-vue/nuxt/dist/preset.cjs:97:22)
    at async createViteServer (./node_modules/.pnpm/@storybook+builder-vite@7.4.5_typescript@4.9.5_vite@4.4.9/node_modules/@storybook/builder-vite/dist/index.js:159:10530)
    at async Module.start (./node_modules/.pnpm/@storybook+builder-vite@7.4.5_typescript@4.9.5_vite@4.4.9/node_modules/@storybook/builder-vite/dist/index.js:159:12527)

WARN Broken build, fix the error above.
WARN You may need to refresh the browser.

 ELIFECYCLE  Command failed with exit code 1.

Things tried

  1. I confirmed the file it is looking for does indeed exist.
  2. I tried disabling mdc in Nuxt Content, but this didn't help.
  3. I tried making a repro for you but for some reason Storybook just hung and never launched :(
@miclgael miclgael changed the title bug(nuxt-content): could not load file mdc-imports.mjs bug(nuxt-content): could not load file mdc-imports.mjs Sep 29, 2023
@daniellacosse
Copy link

Getting the issue as well

@miclgael
Copy link
Author

miclgael commented Nov 6, 2023

Hi @daniellacosse - any chance you could do up a reproduction? Not sure what I was doing wrong :3

@MichaelJCole
Copy link

I'm not using Storybook, but I have this exact same issue with a Nuxt 3 programmatic build.

I have a working version (a "reproduction") and a non-working version (my app). Both builds work without the content module.

The difference seems to be tsconfig.server.json.

tsconfig.server.json - not working

      "#mdc-imports": [
        "./file:/home/michael/causing-us/friend-server/.quasar/electron/baseLayer/.nuxt/mdc-imports"
      ],

tsconfig.server.json - working

      "#mdc-imports": [
        "./mdc-imports"
      ],

Not sure how to debug this. Why does it use a file: protocol?

@richard-edwards
Copy link

I'm getting the same error with my project which is using Nuxt Content and Nuxt UI Pro. I can reproduce it by installing the nuxt-ui-pro saas template (https://github.com/nuxt-ui-pro/saas) with npx nuxi init -t github:nuxt-ui-pro/saas and then doing the standard storybook install.
You'll need a NUXT_UI_PRO_LICENSE to create a production build so maybe the nuxt ui guys can get you one to test it out. I don't think the error is UI Pro though, I think it's Content because of the MDC component.

Just thought you could try this as a repro. Might even be able to use Content Wind to see the error, https://github.com/atinux/content-wind

@richard-edwards
Copy link

So I just quickly confirmed the Content Wind has the same issue.

Easy repro:

npx nuxi@latest init -t themes/content-wind my-website

npm install -D @nuxtjs/storybook 

// edit nuxt.config.js
export default defineNuxtConfig(
{
  modules: ['@nuxtjs/storybook']
})

npx storybook-nuxt init

pnpm run storybook

[nitro 5:58:07 p.m.]  ERROR  Error: Could not load file:///home/richard/skunkworks/my-website/.nuxt/mdc-imports.mjs (imported by node_modules/.pnpm/@nuxtjs+mdc@0.3.2/node_modules/@nuxtjs/mdc/dist/runtime/parser/index.mjs): ENOENT: no such file or directory, open 'file:///home/richard/skunkworks/my-website/.nuxt/mdc-imports.mjs'


undefined

=> Failed to build the preview
Error: Error: Could not load file://./.nuxt/mdc-imports.mjs (imported by node_modules/.pnpm/@nuxtjs+mdc@0.3.2/node_modules/@nuxtjs/mdc/dist/runtime/parser/index.mjs): ENOENT: no such file or directory, open 'file://./.nuxt/mdc-imports.mjs'
    at defineNuxtConfig (./node_modules/.pnpm/@storybook-vue+nuxt@0.2.1_@types+node@18.19.8_nuxt@3.9.3_vite@5.0.12_vue@3.3.13/node_modules/@storybook-vue/nuxt/dist/preset.cjs:6676:11)
    at async Object.viteFinal (./node_modules/.pnpm/@storybook-vue+nuxt@0.2.1_@types+node@18.19.8_nuxt@3.9.3_vite@5.0.12_vue@3.3.13/node_modules/@storybook-vue/nuxt/dist/preset.cjs:6697:22)
    at async createViteServer (./node_modules/.pnpm/@storybook+builder-vite@7.6.7_typescript@5.3.3_vite@5.0.12/node_modules/@storybook/builder-vite/dist/index.js:159:10562)
    at async Module.start (./node_modules/.pnpm/@storybook+builder-vite@7.6.7_typescript@5.3.3_vite@5.0.12/node_modules/@storybook/builder-vite/dist/index.js:159:12804)

WARN Broken build, fix the error above.
WARN You may need to refresh the browser.

Hope this helps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants