L. Dabbeet
L. Dabbeet

Reputation: 320

How to deploy nextjs with Lerna.js project using Zeit Now integrated with Github)

When I push my Next project to GitHub, I get the following error : You defined 1 build that did not match any source files (please ensure they are NOT defined in .nowignore) and this how my now.json looks like:

`

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

`

and Package.json file which located on the root folder contains the following :

`

{
  "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"
}

` And this the project tree: enter image description here

Upvotes: 1

Views: 1329

Answers (1)

Nour Sammour
Nour Sammour

Reputation: 2852

try this in 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"
  }
}

Where next-app is your next.js app package

Upvotes: 2

Related Questions