mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Catch errors from update-check (#4276)
Makes sure that Next.js can be started in development mode while being offline.
This commit is contained in:
parent
6bc363e615
commit
3da0049424
|
@ -114,13 +114,17 @@ export default class Server {
|
||||||
|
|
||||||
async prepare () {
|
async prepare () {
|
||||||
if (this.dev && process.stdout.isTTY) {
|
if (this.dev && process.stdout.isTTY) {
|
||||||
const checkForUpdate = require('update-check')
|
try {
|
||||||
const update = await checkForUpdate(pkg, {
|
const checkForUpdate = require('update-check')
|
||||||
distTag: pkg.version.includes('canary') ? 'canary' : 'latest'
|
const update = await checkForUpdate(pkg, {
|
||||||
})
|
distTag: pkg.version.includes('canary') ? 'canary' : 'latest'
|
||||||
if (update) {
|
})
|
||||||
// bgRed from chalk
|
if (update) {
|
||||||
console.log(`\u001B[41mUPDATE AVAILABLE\u001B[49m The latest version of \`next\` is ${update.latest}`)
|
// bgRed from chalk
|
||||||
|
console.log(`\u001B[41mUPDATE AVAILABLE\u001B[49m The latest version of \`next\` is ${update.latest}`)
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error checking updates', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue