如何使用与Github集成的Zeit Now在Lerna.js项目中部署nextjs)

时间:2019-08-04 17:29:21

标签: reactjs next.js lerna zeit-now

当我将Next项目推送到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"
}

` 这是项目树: enter image description here

1 个答案:

答案 0 :(得分: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应用程序包