vuejs / vue-migration-helper

CLI tool to aid in migration from Vue 1.x to 2.0
594 stars 59 forks source link

Cannot read property 1 of null #10

Closed vedovelli closed 8 years ago

vedovelli commented 8 years ago

node -v outputs v6.6.0

MacOSX

Command line output:

  var library = fileData.file.match(/([^\/]+)\/[^\/]+\.js/)[1]
                                                           ^

TypeError: Cannot read property '1' of null
    at module.exports (/usr/local/lib/node_modules/vue-migration-helper/helpers/report-warning.js:11:60)
    at /usr/local/lib/node_modules/vue-migration-helper/helpers/check-for-deprecations.js:22:7
    at Array.some (native)
    at module.exports (/usr/local/lib/node_modules/vue-migration-helper/helpers/check-for-deprecations.js:19:16)
    at Stream.<anonymous> (/usr/local/lib/node_modules/vue-migration-helper/index.js:35:36)
    at emitOne (events.js:96:13)
    at Stream.emit (events.js:188:7)
    at drain (/usr/local/lib/node_modules/vue-migration-helper/node_modules/through/index.js:36:16)
    at Stream.stream.queue.stream.push (/usr/local/lib/node_modules/vue-migration-helper/node_modules/through/index.js:45:5)
    at emit (/usr/local/lib/node_modules/vue-migration-helper/node_modules/split/index.js:37:14)```
txchen commented 8 years ago

I got the same issue. My node version 6.7.0

Rhincodon commented 8 years ago

v5.5.0 the same

taichunmin commented 8 years ago

edit vue-migration-helper/helpers/report-warning.js to temporarily bypass the bug:

'use strict'

var chalk = require('chalk')
var migrationGuideUrlFor = require('./migration-guide-url-for')

var warningCount = 0
module.exports = function (fileData, warning) {
  // if (process.env.NODE_ENV === 'test') return
  warningCount++

  console.log()
  console.log(chalk.yellow(
    warningCount + '. ' + warning.fix
  ))
  console.log(chalk.blue('  Line ' + fileData.lineNum + ': ' + fileData.file))
  console.log(chalk.cyan.dim('  Reason: ' + warning.reason))
  console.log(chalk.cyan.dim(
    '  More info: ' +
    chalk.underline('http://rc.vuejs.org/guide/migration.html#' + warning.docsHash)
  ))
}
chrisvfritz commented 8 years ago

This has now been fixed!

fanyang89 commented 8 years ago
C:\Users\fuis\AppData\Roaming\npm\node_modules\vue-migration-helper\helpers\report-warning.js:10
  var library = rule.file.match(/([^\/]+)\/[^\/]+\.js/)[1]
                                                       ^

TypeError: Cannot read property '1' of null
    at module.exports (C:\Users\fuis\AppData\Roaming\npm\node_modules\vue-migration-helper\helpers\report-warning.js:10:56)
    at C:\Users\fuis\AppData\Roaming\npm\node_modules\vue-migration-helper\helpers\check-for-deprecations.js:26:7
    at Array.some (native)
    at module.exports (C:\Users\fuis\AppData\Roaming\npm\node_modules\vue-migration-helper\helpers\check-for-deprecations.js:23:16)
    at Stream.<anonymous> (C:\Users\fuis\AppData\Roaming\npm\node_modules\vue-migration-helper\index.js:35:36)
    at emitOne (events.js:96:13)
    at Stream.emit (events.js:188:7)
    at drain (C:\Users\fuis\AppData\Roaming\npm\node_modules\vue-migration-helper\node_modules\through\index.js:36:16)
    at Stream.stream.queue.stream.push (C:\Users\fuis\AppData\Roaming\npm\node_modules\vue-migration-helper\node_modules\through\index.js:45:5)
    at emit (C:\Users\fuis\AppData\Roaming\npm\node_modules\vue-migration-helper\node_modules\split\index.js:37:14)

Me too

chrisvfritz commented 8 years ago

@YangFan789 Try again. This should now also be fixed on Windows.