V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
FlowerChen
V2EX  ›  问与答

求 Node 大神帮忙, global is not defined 解决方法

  •  
  •   FlowerChen · 2017-04-18 22:43:25 +08:00 · 4723 次点击
    这是一个创建于 2566 天前的主题,其中的信息可能已经有所发展或是发生改变。

    菜鸟一枚毕业设计要用 node-webkit 写一个东西,从网上拷了别人的项目,然后运行时一只提示 Uncaught ReferenceError: global is not defined ; 报错地方代码:

    <script type="text/javascript"> global.window = window; global.$ = $; // 加载 nw.gui 模块 global.gui = require('nw.gui'); hljs.initHighlightingOnLoad(); init(); </script>
    1 条回复    2017-04-19 07:53:54 +08:00
    tinyproxy
        1
    tinyproxy  
       2017-04-19 07:53:54 +08:00 via iPhone
    https://github.com/nwjs/nw.js/wiki/Differences-of-JavaScript-contexts

    我记得有 workaround 的方法,不行的话开 issue 问问 Roger
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1421 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 17:13 · PVG 01:13 · LAX 10:13 · JFK 13:13
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.