【发布时间】:2020-08-02 20:47:33
【问题描述】:
反应/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 () {
...
【问题讨论】:
-
您能给我们看看代码吗?该错误表示您尝试拆分的字符串未定义,我们需要代码来查看原因。
-
我改了帖子。
-
请帮帮我..ㅠㅠ
-
你能不能做 console.log(process.versions.node) 并给我们看结果
-
结果未定义。
标签: reactjs npm server split nodemon