未find未捕获的模块jqueryify
我的情况
我正在检查spine.js的Web应用程序,我正在考虑编写。 我已经阅读了所有的文档,并通过了所有的例子。 现在我试图在我自己的Windows 7笔记本电脑上运行spine.contacts示例项目。
我正在运行Windows的节点v0.6.6
我做了什么
- 已安装节点
- 通过NPM安装脊柱,脊柱应用程序和下摆
- 提取spine.contacts在一个文件夹中
- 运行
npm install .
里面的文件夹,其中创build了一堆目录里面,包括jqueryify node_modules文件夹 - 运行
hem server
以启动testing服务器 - 基本上遵循了所有的信函的指示
问题
在Chrome(http:// localhost:9294)中运行应用程序,JavaScript会在index.html中的第9行引发exception(我在下面包含了index.html)。 它读取“未捕获的模块jqueryify未find”。 我知道jqueryify的依赖是由npm早些时候安装的,但我仍然尝试删除该行,并手动链接到jQuery中。 现在我得到了application.js中的“Uncaught module index not found”错误。 这当然不是一个依赖错误,因为index.js文件是本地的,它是项目中的主脚本文件。
所以看起来require函数有问题。 我GOOGLE了很多,没有发现我已经表明,spine.js不应该在Windows上工作。
有任何想法吗?
一些链接
- Spine.contacts的GIT页面
- herokuapp.com上完全相同的项目演示
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>
Windows不支持Hem。 我发现自己处于相同的情况,并尝试了相同的方法。
更多信息在这里: https : //github.com/maccman/hem/issues/23
尝试在第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]; }
我想很快就会有一个解决scheme。