【问题标题】:Nuxt js Error Couldn't find a pages directoryNuxt js错误找不到页面目录
【发布时间】:2019-02-03 08:11:35
【问题描述】:

我更改了 nuxt js 文件夹结构在这里。我收到错误:在 D:\sample 中找不到页面目录。请在项目根目录下创建一个如何访问页面

.nuxt, 应用程序, 节点模块, 服务器, .eslintrc, 包裹, 包锁

Error: Couldn't find a pages directory in D:\sample. Please create one under the project root

【问题讨论】:

    标签: node.js express vue.js nuxt.js


    【解决方案1】:

    您需要创建一个名为pages 的文件夹,以允许nuxt 生成您的应用程序的路由!

    更多信息在这里:Routing

    如果您想更改文件夹的结构,请查看Change Directory

    nuxt.config.js module.exports = { srcDir: 'client/' }

    你的结构:

    -| app/ ---| node_modules/ ---| client/ ------| pages/ ------| components/ ---| nuxt.config.js ---| package.json

    【讨论】:

    • 感谢您的支持实际上我在应用程序之外使用服务器和应用程序 node_models 我的文件夹结构在这里` -------- | .nu​​xt -------- |应用程序----------- | nuxt_config.js -------- |节点模块 --------- |服务器 --------- | pacakge.json `
    • 能否提供您的应用文件夹的截图?
    • 您需要在 nuxt.config.js 中更改这一行:module.exports = { srcDir: 'app/' }
    【解决方案2】:

    这里是解决方案。 通过这种方式,您不需要伪造副本来使服务器正常工作。创建并将 args 传递给下一个构造函数:

    // Add path module
    const path = require('path')
    
    // Init the Next app with args: 
    const app = next({ dir: path.join(__dirname, '..', 'yourwww'), dev })
    

    【讨论】:

      猜你喜欢
      • 2020-11-16
      • 2022-11-09
      • 2020-09-06
      • 2012-11-13
      • 1970-01-01
      • 1970-01-01
      • 2021-01-12
      • 2012-12-29
      • 1970-01-01
      相关资源
      最近更新 更多