UNPKG

659 BJavaScriptView Raw
1'use strict'
2const pkg = require('./package.json')
3const MIN_VER = pkg.engines.node.match(/(\d+(\.\d+)?)/)[1]
4const fmin = parseFloat(MIN_VER)
5const nver = process.version
6
7if (parseFloat(nver.slice(1)) < fmin) {
8 console.error(`
9+-------------------------------------------------------+
10| The cbor package REQUIRES Node.js v${MIN_VER} or higher. ${' '.repeat(7 - MIN_VER.length)}|
11| You are currently running Node.js ${nver} ${' '.repeat(19 - nver.length)}|
12| Please upgrade node, or pin cbor to version 5.2.x: |
13| \`npm install --save cbor@5.2\` |
14+-------------------------------------------------------+
15`)
16 process.exit(1)
17}