首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法使用node.js安装jquery -无法加载Contextify

无法使用node.js安装jquery -无法加载Contextify
EN

Stack Overflow用户
提问于 2012-02-21 18:16:26
回答 2查看 3.5K关注 0票数 1

更新-见post的底部

我试图在node.js中设置jquery,但遇到了一些麻烦。作为described on SO,我使用npm install jquery安装jquery,并将javascript作为命令行的脚本执行,而不是作为服务器运行。

有几点需要注意:

1.1.1

  • node-waf

  • OS X 10.7.3

  • node.js版本0.6.11

  • npm版本1.5.16

因此,在包含我的节点脚本的目录中,我是npm install jquery。终端然后启动5秒,做一些事情,特别是下载模块和构建上下文。最后,消息是'build' finished successfully

另外,从安装日志中可以看到:

  • jsdom解析器1.7.4
  • jsdom 0.2.10

我试图在这里运行我的脚本:./script.js,但这是输出:

代码语言:javascript
复制
Internal Contextify ERROR: Make sure Contextify is build with your current Node version. 
To rebuild, go to the Contextify root folder and run 'node-waf distclean && node-waf configure build'.

因此,我要做以下几点:

代码语言:javascript
复制
$ cd node_modules/jquery/node_modules/jsdom/node_modules/contextify/
$ node-waf distclean && node-waf configure build

'distclean' finished successfully (0.002s)
Setting srcdir to:     /proj/node_modules/jquery/node_modules/jsdom/node_modules/contextify 
Setting blddir to:     /proj/node_modules/jquery/node_modules/jsdom/node_modules/contextify/build 
Checking for program g++ or c++          : /usr/bin/g++ 
Checking for program cpp                 : /usr/bin/cpp 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Checking for g++                         : ok  
Checking for node path                   : not found 
Checking for node prefix                 : ok /usr/local 
'configure' finished successfully (0.729s)
Waf: Entering directory `/proj/node_modules/jquery/node_modules/jsdom/node_modules/contextify/build'
[1/2] cxx: src/contextify.cc -> build/Release/src/contextify_1.o
[2/2] cxx_link: build/Release/src/contextify_1.o -> build/Release/contextify.node
Waf: Leaving directory `/proj/node_modules/jquery/node_modules/jsdom/node_modules/contextify/build'
'build' finished successfully (3.335s)

然而,当我运行我的脚本时,我仍然得到了Internal Contextify ERROR。下面是完整的错误消息:

代码语言:javascript
复制
Internal Contextify ERROR: Make sure Contextify is built with your current Node version.
To rebuild, go to the Contextify root folder and run 'node-waf distclean && node-waf configure build'.

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
          ^
Error: Unable to load shared library /proj/node_modules/jquery/node_modules/jsdom/node_modules/contextify/build/Release/contextify.node
    at Object..node (module.js:472:11)
    at Module.load (module.js:348:31)
    at Function._load (module.js:308:12)
    at Module.require (module.js:354:17)
    at require (module.js:370:17)
    at Object.<anonymous>(/proj/node_modules/jquery/node_modules/jsdom/node_modules/contextify/lib/contextify.js:2:22)
    at Module._compile (module.js:441:26)
    at Object..js (module.js:459:10)
    at Module.load (module.js:348:31)
    at Function._load (module.js:308:12)

在我看来,not found是编译时Checking for node path的输出,这让我感到奇怪,但我不知道如何处理它,只知道这对我来说是出乎意料的。

如果有人能提供任何建议,我将非常感激!

更新- 2/21/12

经过更多的研究,我已经能够解决节点路径不被发现的奇怪之处。在终端中执行:export NODE_PATH="/usr/local/lib/node"后,在构建过程中找到节点路径。但是,在移除jquery模块并再次安装/构建之后,我仍然处于相同的情况。

contextify.node文件存在于指定的发行目录中,但我的脚本仍然无法加载它。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-02-22 04:19:06

因此,这似乎是一个32位vs 64位的问题,并特别与node.js v0.6.11在此池。显然,Contextify是一个64位的库,但是node.js 0.6.11的下载是一个32位的可执行文件。将评级下调至0.6.10似乎对我有用。

不确定这对未来意味着什么,但以下是我为其他感兴趣的人找到的资源:

票数 3
EN

Stack Overflow用户

发布于 2012-03-14 17:24:50

我按照以下说明修正了上下文化问题:

对于那些习惯了npm的魔力的人,只要在https://github.com/Benvie/contextify/zipball/master下载ZIP文件,将其解压缩到您的node_modules文件夹中,然后将该文件夹重命名为“上下文化”,就可以使用be的预构建二进制文件。请注意,此二进制文件仅在节点0.6的windows中工作,因此,如果您通过源代码控制与非windows用户共享node_modules文件夹,请小心。(编辑:如下一条注释中所指出的,修复了链接)。

来自https://github.com/brianmcd/contextify/issues/12

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9382868

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档