【问题标题】:How to deploy nextjs with Lerna.js project using Zeit Now integrated with Github)如何使用与 Github 集成的 Zeit Now 部署带有 Lerna.js 项目的 nextjs)
【发布时间】:2019-12-12 09:33:11
【问题描述】:

当我将下一个项目推送到 GitHub 时,我收到以下错误: 您定义的 1 个版本与任何源文件都不匹配(请确保它们未在 .nowignore 中定义) 这就是我的 now.json 的样子:

`

{
  "version": 2,
  "builds": [
    {
      "src": "packages/web-app/package.json",
      "use": "@now/next"
    }
  ],
  "build": {
    "env": {
      "SECRET": "dev-key",
      "ANOTHER_SECRET": "another-dev-key"
    }
  }
}

`

并且位于根文件夹的 Package.json 文件包含以下内容:

`

{
  "name": "biletiniz",
  "private": true,
  "workspaces": [
    "packages/*"
  ],
  "scripts": {
    "bootstrap": "lerna bootstrap",
    "dev": "lerna bootstrap && lerna run dev",
    "build": "lerna bootstrap && lerna run build",
    "start": "lerna bootstrap && lerna run start"
  },
  "dependencies": {
    "lerna": "^3.16.4"
  },
  "version": "1.0.0",
  "author": "LamaDabbeet",
  "license": "MIT"
}

` 这是项目树:

【问题讨论】:

    标签: reactjs next.js lerna vercel


    【解决方案1】:

    在 Now.js V2 中试试这个:

    {
      "version": 2,
      "name": "awesome-app",
      "builds": [
        {
          "src": "packages/next-app/package.json",
          "use": "@now/next"
        }
      ],
      "routes": [
        {
          "src": "/(.*)",
          "dest": "/packages/next-app/$1",
          "headers": {
            "x-request-path": "$1"
          }
        }
      ],
      "env": {
        "SECRET": "dev-key",
        "ANOTHER_SECRET": "another-dev-key"
      }
    }
    

    next-app 是你的 next.js 应用包

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-05-12
      • 2019-06-23
      • 1970-01-01
      • 2019-08-09
      • 2019-10-11
      • 1970-01-01
      • 2019-12-24
      • 1970-01-01
      相关资源
      最近更新 更多