Skip to content

Commit

Permalink
Merge pull request #602 from netlify/fix/error-no-targetport
Browse files Browse the repository at this point in the history
show useful error if targetPort is unknown
  • Loading branch information
RaeesBhatti authored Dec 12, 2019
2 parents 8d7d16a + 49f347f commit 4e7d443
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/commands/dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ const find = require('find-process')
const {
NETLIFYDEV,
NETLIFYDEVLOG,
NETLIFYDEVWARN
// NETLIFYDEVERR
NETLIFYDEVWARN,
NETLIFYDEVERR
} = require('../../utils/logo')
const boxen = require('boxen')
const { createTunnel, connectTunnel } = require('../../utils/live-tunnel')
Expand Down Expand Up @@ -125,7 +125,14 @@ function initializeProxy(port) {
}

async function startProxy(settings, addonUrls) {
await waitPort({ port: settings.proxyPort })
try {
await waitPort({ port: settings.proxyPort })
} catch(err) {
console.error(NETLIFYDEVERR, `Netlify Dev doesn't know what port your site is running on.`)
console.error(NETLIFYDEVERR, `Please set --targetPort.`)
this.exit(1)
}

if (settings.functionsPort) {
await waitPort({ port: settings.functionsPort })
}
Expand Down

0 comments on commit 4e7d443

Please sign in to comment.