我正在尝试从源代码构建kibana,有人能告诉我这是什么问题吗?
感谢。
C:\workspace\kibana>grunt -v
Initializing
Command-line options: --verbose
Reading "Gruntfile.js" Gruntfile...OK
Registering Gruntfile tasks.
Reading package.json...OK
Parsing package.json...OK
...
Loading "Gruntfile.js" tasks...ERROR
>> ReferenceError: window is not defined
>> at Object.<anonymous> (C:\workspace\kibana\node_modules\load-grunt-config\node_modules\js-yaml\lib\js-yaml\type\js\function.js:17:7)
>> at Module._compile (module.js:456:26)
>> at Object.Module._extensions..js (module.js:474:10)
>> at Module.load (module.js:356:32)
>> at Function.Module._load (module.js:312:12)
>> at Module.require (module.js:364:17)
>> at require (module.js:380:17)
>> at Object.<anonymous> (C:\workspace\kibana\node_modules\load-grunt-config\node_modules\js-yaml\lib\js-yaml\schema\default_full.js:23:5)
>> at Module._compile (module.js:456:26)
>> at Object.Module._extensions..js (module.js:474:10)
>> at Module.load (module.js:356:32)
>> at Function.Module._load (module.js:312:12)
>> at Module.require (module.js:364:17)
>> at require (module.js:380:17)
>> at Object.<anonymous> (C:\workspace\kibana\node_modules\load-grunt-config\node_modules\js-yaml\lib\js-yaml\loader.js:8:27)
>> at Module._compile (module.js:456:26)
>> at Object.Module._extensions..js (module.js:474:10)
>> at Module.load (module.js:356:32)
>> at Function.Module._load (module.js:312:12)
>> at Module.require (module.js:364:17)
>> at require (module.js:380:17)
>> at Object.<anonymous> (C:\workspace\kibana\node_modules\load-grunt-config\node_modules\js-yaml\lib\js-yaml.js:4:14)
>> at Module._compile (module.js:456:26)
>> at Object.Module._extensions..js (module.js:474:10)
>> at Module.load (module.js:356:32)
>> at Function.Module._load (module.js:312:12)
>> at Module.require (module.js:364:17)
>> at require (module.js:380:17)
>> at Object.<anonymous> (C:\workspace\kibana\node_modules\load-grunt-config\node_modules\js-yaml\index.js:6:12)
>> at Module._compile (module.js:456:26)
>> at Object.Module._extensions..js (module.js:474:10)
>> at Module.load (module.js:356:32)
>> at Function.Module._load (module.js:312:12)
>> at Module.require (module.js:364:17)
>> at require (module.js:380:17)
>> at Object.<anonymous> (C:\workspace\kibana\node_modules\load-grunt-config\lib\load-config.js:3:14)
>> at Module._compile (module.js:456:26)
>> at Object.Module._extensions..js (module.js:474:10)
>> at Module.load (module.js:356:32)
>> at Function.Module._load (module.js:312:12)
>> at Module.require (module.js:364:17)
>> at require (module.js:380:17)
>> at Object.module.exports (C:\workspace\kibana\Gruntfile.js:75:3)
>> at loadTask (C:\workspace\kibana\node_modules\grunt\lib\grunt\task.js:325:10)
>> at Task.task.init (C:\workspace\kibana\node_modules\grunt\lib\grunt\task.js:437:5)
>> at Object.grunt.tasks (C:\workspace\kibana\node_modules\grunt\lib\grunt.js:120:8)
>> at Object.module.exports [as cli] (C:\workspace\kibana\node_modules\grunt\lib\grunt\cli.js:38:9)
>> at Object.<anonymous> (C:\Users\IBM_ADMIN\AppData\Roaming\npm\node_modules\grunt-cli\bin\grunt:45:20)
>> at Module._compile (module.js:456:26)
>> at Object.Module._extensions..js (module.js:474:10)
>> at Module.load (module.js:356:32)
>> at Function.Module._load (module.js:312:12)
>> at Function.Module.runMain (module.js:497:10)
>> at startup (node.js:119:16)
>> at node.js:906:3
No tasks specified, running default tasks.
Running tasks: default
Warning: Task "default" not found. Use --force to continue.
Aborted due to warnings.
注意:
我从github克隆了kibana repo并没有做任何改动,我还检查了 function.js 中的代码,并且确实引用了 window :
...
try {
esprima = require('esprima');
} catch (_) {
/*global window */
if (window) { esprima = window.esprima; }
}
...
据我了解,服务器端javascript中不应存在窗口,所以我想知道它是如何工作的?