1

我有使用 jQuery 的 node.js 应用程序。启动此应用程序时出现错误:

imac-micha:socketiochat me$ node some_app.js
Warning: Native modules not compiled.  XOR performance will be degraded. Warning: Native modules not compiled.  UTF-8 validation disabled.

/Users/me/dev_dir/socketiochat/node_modules/jquery/lib/node-jquery.js:10
    window.XMLHttpRequest.prototype.withCredentials = false;
                         ^
    TypeError: Cannot read property 'prototype' of undefined
    at create (/Users/me/dev_dir/socketiochat/node_modules/jquery/lib/node-jquery.js:10:26)
    at /Users/me/dev_dir/socketiochat/node_modules/jquery/lib/node-jquery.js:9503:18
    at Object.<anonymous> (/Users/me/dev_dir/socketiochat/node_modules/jquery/lib/node-jquery.js:9505:2)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/Users/me/dev_dir/socketiochat/some_app.js:8:9)
imac-micha:socketiochat me$

我听说(实际上找到了这样的建议解决方案)npm rebuild会有所帮助,所以我尝试了,但也得到了错误:

imac-micha:socketiochat me$ npm rebuild
npm WARN package.json application-name@0.0.1 No repository field.
npm WARN package.json application-name@0.0.1 No readme data.
npm WARN package.json jsdom@0.2.19 No repository field.
npm WARN package.json jsdom@0.2.19 'repositories' (plural) Not supported.
npm WARN package.json Please pick one as the 'repository' field
npm WARN package.json mongoose@3.3.1 bugs.email field must be a string email. Deleted.
npm WARN package.json restler@2.0.1 No repository field.
npm WARN package.json sass@0.5.0 No repository field.
npm WARN package.json sprintf@0.1.1 No repository field.
npm WARN package.json cssom@0.2.5 No readme data.
npm WARN package.json ms@0.1.0 No repository field.
npm WARN package.json policyfile@0.0.4 No repository field.
npm WARN package.json policyfile@0.0.4 'repositories' (plural) Not supported.
npm WARN package.json Please pick one as the 'repository' field
npm WARN package.json connect@1.9.2 No readme data.
npm WARN package.json node-uuid@1.1.0 No repository field.
npm WARN package.json css@1.0.8 No repository field.
npm WARN package.json uglify-js@2.2.5 'repositories' (plural) Not supported.
npm WARN package.json Please pick one as the 'repository' field
npm WARN package.json hiredis@0.1.14 No repository field.
npm WARN package.json hiredis@0.1.14 No readme data.
npm WARN package.json css-parse@1.0.4 No repository field.
npm WARN package.json css-stringify@1.0.5 No repository field.
npm WARN package.json addressparser@0.1.3 No repository field.
npm WARN unmet dependency /Users/me/dev_dir/socketiochat/node_modules/mongoose requires mongodb@'1.1.11' but will load
npm WARN unmet dependency /Users/me/dev_dir/socketiochat/node_modules/mongodb,
npm WARN unmet dependency which is version 1.2.13

> base64@2.1.0 install /Users/me/dev_dir/socketiochat/node_modules/base64
> node-gyp rebuild

  CXX(target) Release/obj.target/base64/base64.o
  SOLINK_MODULE(target) Release/base64.node
  SOLINK_MODULE(target) Release/base64.node: Finished
  ACTION binding_gyp_after_build_target_symlink /Users/me/dev_dir/socketiochat/node_modules/base64/base64.node
ln: /Users/me/dev_dir/socketiochat/node_modules/base64/base64.node: File exists
make: *** [/Users/me/dev_dir/socketiochat/node_modules/base64/base64.node] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Darwin 11.4.2
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/me/dev_dir/socketiochat/node_modules/base64
gyp ERR! node -v v0.10.11
gyp ERR! node-gyp -v v0.10.0
gyp ERR! not ok 
npm ERR! weird error 1
npm ERR! not ok code 0

我已经安装了 make(因为我有 XCode),但我不知道这个 base64.node 模块发生了什么。

我的规格:

OSX - 11.4.2 达尔文内核版本 11.4.2:2012 年 8 月 23 日星期四 16:25:48 PDT;根:xnu-1699.32.7~1/RELEASE_X86_64 x86_64 节点 - v0.10.11 jQuery - 1.8.3

感谢您的最终帮助!

4

0 回答 0