npmcheckversion.js 329 B

12345678
  1. const { exec } = require('child_process')
  2. exec('npm -v', (err, stdout) => {
  3. if (err) throw err
  4. if (parseFloat(stdout) < 5) {
  5. // NOTE: This can happen if you have a dependency which lists an old version of npm in its own dependencies.
  6. throw new Error(`[ERROR] You need npm version @>=5 but you have ${stdout}`)
  7. }
  8. })