npm run dev运行报错信息如下图:

vue npm run dev 报错 semver\semver.js:312     throw new TypeError('Invalid Version: ' + version)

原因分析:

版本问题

解决办法:

在semver.js(node_modules/semver/semver.js)里做了一些改动,代码如下:

// if ANY of the sets match ALL of its comparators, then pass
Range.prototype.test = function(version) {
    return true;//add 2019年3月6日13:34:50
  if (!version)
    return false;

  if (typeof version === 'string')
    version = new SemVer(version, this.options);

  for (var i = 0; i < this.set.length; i++) {
    if (testSet(this.set[i], version, this.options))
      return true;
  }
  return false;
};

去掉了检查版本,就不报错了

 

相关文章:

  • 2022-12-23
  • 2021-04-18
  • 2021-10-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
  • 2021-10-05
  • 2021-10-15
  • 2021-05-27
  • 2022-12-23
相关资源
相似解决方案