未找到未捕获的模块 jqueryify

发布于 2024-12-23 17:22:33 字数 1862 浏览 4 评论 0原文

我的情况是,

我正在查看 spin.js 来获取我正在考虑编写的 Web 应用程序。我已阅读所有文档并浏览了所有示例。现在,我尝试在我自己的 Windows 7 笔记本电脑上运行 spin.contacts 示例项目。

我正在为 Windows 运行节点 v0.6.6

我做了什么

  • 安装了节点
  • 通过 npm 安装了pine、spine-app 和 hem
  • 在文件夹中提取了pine.contacts
  • 在文件夹内运行 npm install . ,其中创建了node_modules文件夹,里面有一堆目录,包括jqueryify
  • 运行hem server来启动测试服务器
  • 基本上遵循了所有的说明

的问题

在Chrome中运行应用程序 (http://localhost:9294),JavaScript 在index.html 的第9 行抛出异常(我在下面包含了index.html)。它显示“未找到未捕获的 jqueryify 模块”。我知道 jqueryify 依赖项是由 npm 早些时候安装的,但我尝试删除该行并手动链接到 jQuery。现在我在 application.js 中收到错误“未找到未捕获的模块索引”。这当然不是依赖错误,因为 index.js 文件是本地的,并且它是项目中的主脚本文件。

所以看来 require 函数有问题。我在 Google 上搜索了很多,但没有发现任何表明 spin.js 不应该在 Windows 上运行的情况。

有什么想法吗?


一些链接


index.html:

<!DOCTYPE html>
<html>
<head>
  <meta charset=utf-8>
  <title>App</title>
  <link rel="stylesheet" href="/application.css" type="text/css" charset="utf-8">
  <script src="/application.js" type="text/javascript" charset="utf-8"></script>
  <script type="text/javascript" charset="utf-8">
    var jQuery  = require("jqueryify"); // I'm line 9!!
    var exports = this;
    jQuery(function(){
      var App = require("index");
      exports.app = new App({el: $("#article")});      
    });
  </script>  
</head>
<body>
  <header id="header"><h1>Spine Contacts</h1></header>
  <article id="article"></article>
</body>
</html>

My situation

I'm checking out spine.js for a web application I'm thinking of writing. I've read all the documentation and gone through all the examples. Now I'm trying to run the spine.contacts example project on my own Windows 7 laptop.

I'm running node v0.6.6 for Windows

What I've done

  • Installed node
  • Installed spine, spine-app and hem through npm
  • Extracted spine.contacts in a folder
  • Run npm install . inside the folder, which created the node_modules folder with a bunch of directories inside, including jqueryify
  • Run hem server to start the test server
  • Basically followed all the instructions to the letter

The problem

Running the application in Chrome (http://localhost:9294), JavaScript throws an exception at line 9 in index.html (I've included index.html below). It reads "Uncaught module jqueryify not found". I know the jqueryify dependency was installed by npm earlier, but I tried removing that line anyway and linking in jQuery manually. Now I got the error "Uncaught module index not found" in application.js. That certainly isn't a dependency error, since the index.js file is local and it's the main script file in the project.

So it seems there's a problem with the require function. I've Googled a lot and nothing I've found has indicated that spine.js shouldn't work on Windows.

Any ideas?


Some links


index.html:

<!DOCTYPE html>
<html>
<head>
  <meta charset=utf-8>
  <title>App</title>
  <link rel="stylesheet" href="/application.css" type="text/css" charset="utf-8">
  <script src="/application.js" type="text/javascript" charset="utf-8"></script>
  <script type="text/javascript" charset="utf-8">
    var jQuery  = require("jqueryify"); // I'm line 9!!
    var exports = this;
    jQuery(function(){
      var App = require("index");
      exports.app = new App({el: $("#article")});      
    });
  </script>  
</head>
<body>
  <header id="header"><h1>Spine Contacts</h1></header>
  <article id="article"></article>
</body>
</html>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

浅暮の光 2024-12-30 17:22:33

Windows 不支持折边。我发现自己处于同样的情况并尝试了同样的方法。

更多信息请参见:https://github.com/maccman/hem/issues/23

Hem is not supported on Windows. I found myself in the same situation and tried the same approaches.

More info here: https://github.com/maccman/hem/issues/23

深海夜未眠 2024-12-30 17:22:33

尝试在第 9 行之前插入它:

for(var winPath in require.modules)
{
path = winPath.replace(/\\/g, '/'); 
path = path.match('/node_modules/') ? path.split('/node_modules/')[1] : path;
path = path.match('/app/') ? path.split('/app/')[1] : path;
require.modules[path] = require.modules[winPath];
}

我认为很快就会有修复。

Try inserting that before line 9:

for(var winPath in require.modules)
{
path = winPath.replace(/\\/g, '/'); 
path = path.match('/node_modules/') ? path.split('/node_modules/')[1] : path;
path = path.match('/app/') ? path.split('/app/')[1] : path;
require.modules[path] = require.modules[winPath];
}

I think a fix will be there soon.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文