【问题标题】:Node-webkit require is undefinedNode-webkit 要求未定义
【发布时间】:2015-01-23 10:52:35
【问题描述】:

我正在尝试将 TW5 的服务器版本作为 node-webkit 应用程序运行。我遵循了此处所述的良好说明:https://groups.google.com/d/msg/tiddlywiki/WRnhjD6LUPQ/Zmikdvo0QA0J

  • 要在 node-webkit 中运行这些文件,您需要的代码在这里:https://gist.github.com/Arlen22/d7ad0b6a108fa3cedf72
  • 打开该链接并将 index.htm 和 nodewebkit.js 复制到 tiddlywiki 文件夹的根目录中。
  • 打开 package.json,将 gist 的 package.json 中的两个对象复制到其中。
  • Package.json 已经有一个“主”对象,您需要将其删除。
  • 将整个 tiddlywiki 文件夹拖到 node-webkit 可执行文件上。

当我执行最后一步时,我在 node-webkit 的开发者工具控制台上收到以下错误:

Uncaught ReferenceError: require is not defined
Not allowed to load local resource: file:///C:/Users/.../node-webkit/TW5/index.htm data:text/html,chro…:1

奇怪的是:如果我从地址栏中删除 index.html,则会列出 TW5 文件夹,然后单击 index.html 按预期打开应用程序,完美运行。谁能告诉我问题出在哪里?

提前致谢。

【问题讨论】:

    标签: node-webkit tiddlywiki


    【解决方案1】:

    问题出在 package.json。这有点愚蠢,但我写的是 index.htm 而不是 index.html。因此,如果您收到 Not allowed to load local resource: 错误,请务必检查您的 package.json 是否存在错误名称。

    问候

    【讨论】:

      猜你喜欢
      • 2014-10-26
      • 1970-01-01
      • 2014-06-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-15
      相关资源
      最近更新 更多