TypeError:无法读取nodejs nodemon中未定义的属性'split'

问题描述 投票:0回答:1

error img

react / node.js我不知道是什么问题。它说他们是nodemon中的错误。但是,我找不到问题所在。请帮助我。

index.js:4 Uncaught TypeError: Cannot read property 'split' of undefined
    at Object.<anonymous> (index.js:4)
    at Object.../node_modules/nodemon/lib/utils/index.js (index.js:95)
    at __webpack_require__ (bootstrap:784)
    at fn (bootstrap:150)
    at Object.<anonymous> (run.js:3)
    at Object.../node_modules/nodemon/lib/monitor/run.js (run.js:459)
    at __webpack_require__ (bootstrap:784)
    at fn (bootstrap:150)
    at Object.../node_modules/nodemon/lib/monitor/index.js (index.js:2)
    at __webpack_require__ (bootstrap:784)
    at fn (bootstrap:150)
    ...

这里是代码

var noop = function () { };
var path = require('path');
const semver = require('semver');
//here is the problem. There is a 'split'.
var version = process.versions.node.split('.') || [null, null, null];

var utils = (module.exports = {
  semver: semver,
  satisfies: test => semver.satisfies(process.versions.node, test),
  version: {
    major: parseInt(version[0] || 0, 10),
    minor: parseInt(version[1] || 0, 10),
    patch: parseInt(version[2] || 0, 10),
  },
  clone: require('./clone'),
  merge: require('./merge'),
  bus: require('./bus'),
  isWindows: process.platform === 'win32',
  isMac: process.platform === 'darwin',
  isLinux: process.platform === 'linux',
  isRequired: (function () {
...
reactjs npm server split nodemon
1个回答
0
投票

如果要获取版本,请使用process.version而不是process.versions属性

© www.soinside.com 2019 - 2024. All rights reserved.