question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sources not working

See original GitHub issue

Environment


  • Operating System: Darwin
  • Node Version: v16.15.1
  • Nuxt Version: 3.0.0-rc.11
  • Nitro Version: 0.5.4
  • Package Manager: yarn@1.22.17
  • Builder: vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

πŸ‘‰ Report an issue: https://github.com/nuxt/framework/issues/new 12:02:39

πŸ‘‰ Suggest an improvement: https://github.com/nuxt/framework/discussions/new

πŸ‘‰ Read documentation: https://v3.nuxtjs.org

Reproduction

https://github.com/stursby/nuxt-content-sources-bug

Describe the bug

Trying to get another sources folder called snippets for code snippets. Can’t get it working.

I create a fresh Nuxt Content project with npx nuxi init nuxt-content-source-bug -t content then added a snippets folder in the root dir.

β”œβ”€β”€ README.md
β”œβ”€β”€ app.vue
β”œβ”€β”€ content
β”‚Β Β  β”œβ”€β”€ about.md
β”‚Β Β  └── index.md
β”œβ”€β”€ nuxt.config.ts
β”œβ”€β”€ package.json
β”œβ”€β”€ pages
β”‚Β Β  β”œβ”€β”€ [...slug].vue
β”‚Β Β  └── test.vue
β”œβ”€β”€ snippets
β”‚Β Β  └── hello.md
β”œβ”€β”€ tsconfig.json
└── yarn.lock

I then tried multiple config options to load that directory, but getting the following error in iTerm.

import { resolve } from "path";

// https://v3.nuxtjs.org/api/configuration/nuxt.config
export default defineNuxtConfig({
  modules: ["@nuxt/content"],
  content: {
    // Array w/ String doesn't work
    // sources: ["snippets"],

    // ...doesn't work either
    sources: [
      "snippets",
      {
        name: "snippets",
        driver: "fs",
        base: resolve(__dirname, "snippets"), // Path for source directory
      },
    ],
  },
});

For example, I created a test page and tried to pull in that snippet.

Nuxi 3.0.0-rc.11                                                                                                                                                         12:04:59
Nuxt 3.0.0-rc.11 with Nitro 0.5.4                                                                                                                                        12:04:59
                                                                                                                                                                         12:05:01
  > Local:    http://localhost:3000/
  > Network:  http://10.0.0.196:3000/
  > Network:  http://[2601:445:500:1200:610c:38e7:e249:e1e8]:3000/
  > Network:  http://[2601:445:500:1200:8da:1a0f:e880:45e4]:3000/
  > Network:  http://[2601:445:500:1200::ab06]:3000/

β„Ή Cleaning up generated nuxt files and caches...                                                                                                                         12:05:01

 ERROR  Cannot start nuxt:  Cannot find package 'undefined' imported from /Users/hield/Sites/__SCRAP__/nuxt-content-source-bug/node_modules/nitropack/dist/shared/nitro.9c828268.mjs

  at new NodeError (node:internal/errors:372:5)
  at packageResolve (node:internal/modules/esm/resolve:954:9)
  at moduleResolve (node:internal/modules/esm/resolve:1003:20)
  at defaultResolve (node:internal/modules/esm/resolve:1218:11)
  at ESMLoader.resolve (node:internal/modules/esm/loader:580:30)
  at ESMLoader.getModuleJob (node:internal/modules/esm/loader:294:18)
  at ESMLoader.import (node:internal/modules/esm/loader:380:22)
  at importModuleDynamically (node:internal/modules/esm/translators:106:35)
  at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14)
  at createStorage (node_modules/nitropack/dist/shared/nitro.9c828268.mjs:1189:69)

Additional context

No response

Logs

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:7

github_iconTop GitHub Comments

1reaction
ROBJkEcommented, Sep 27, 2022

@stursby i got exactly same error. i removed the string from array and that worked for me. try this:

import { resolve } from "path";

// https://v3.nuxtjs.org/api/configuration/nuxt.config
export default defineNuxtConfig({
  modules: ["@nuxt/content"],
  content: {
    sources: [
      {
        name: "snippets",
        driver: "fs",
        prefix: "/snippets",
        base: resolve(__dirname, "snippets"), // Path for source directory
      },
    ],
  },
});
0reactions
ManasMadrechacommented, Sep 29, 2022

@ROBJkE yes, thanks, created a new issue for that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

5 Fixes For No Valid Sources Are Available for This Video
We share fixes if your browser has no valid sources for videos. ... While streaming on the internet, you may run into various...
Read more >
Download sources not working, no error given
Sometimes when I try to download sources in Intellij (Java or Kotlin) it simply does nothing. A progress bar at the bottom flashes......
Read more >
References tab - Manage Sources not working in Word
One of our students is trying to make a Bibliography in Word and no styles are showing up in the tab. We tried...
Read more >
Sources within a scene not showing - Forums - OBS Studio
First troubleshooting step would be to toggle the visibility in OBS in the Sources list, and see if they show up. Also, make...
Read more >
Onkyo change Sources not working - media_player
Hi Community After a complete new installation my β€œold” Onkyo Integration yaml file is not working correct. I can power on/off and changeΒ ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found