尝试彻底阅读这个堆栈跟踪,但它并没有让我更聪明。想法?
sudo npm install jquery
npm ERR! registry error parsing json
npm ERR! error installing jquery@1.6.3 SyntaxError: Unexpected token ILLEGAL
npm ERR! error installing jquery@1.6.3 <html><title>Request timeout</title><body><h1>Request timeout</h1></body></html>
npm ERR! error installing jquery@1.6.3 at Object.parse (native)
npm ERR! error installing jquery@1.6.3 at Request._callback (/usr/local/lib/node_modules/npm/lib/utils/npm-registry-client/request.js:147:21)
npm ERR! error installing jquery@1.6.3 at Request.callback (/usr/local/lib/node_modules/npm/node_modules/request/main.js:99:22)
npm ERR! error installing jquery@1.6.3 at Request.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/main.js:361:18)
npm ERR! error installing jquery@1.6.3 at Request.emit (events.js:64:17)
npm ERR! error installing jquery@1.6.3 at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/main.js:327:16)
npm ERR! error installing jquery@1.6.3 at IncomingMessage.emit (events.js:81:20)
npm ERR! error installing jquery@1.6.3 at HTTPParser.onMessageComplete (http.js:133:23)
npm ERR! error installing jquery@1.6.3 at CleartextStream.ondata (http.js:1228:22)
npm ERR! error installing jquery@1.6.3 at CleartextStream._push (tls.js:303:27)
npm ERR! registry error parsing json
npm ERR! SyntaxError: Unexpected token ILLEGAL
npm ERR! <html><title>Request timeout</title><body><h1>Request timeout</h1></body></html>
npm ERR! at Object.parse (native)
npm ERR! at Request._callback (/usr/local/lib/node_modules/npm/lib/utils/npm-registry-client/request.js:147:21)
npm ERR! at Request.callback (/usr/local/lib/node_modules/npm/node_modules/request/main.js:99:22)
npm ERR! at Request.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/main.js:361:18)
npm ERR! at Request.emit (events.js:64:17)
npm ERR! at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/main.js:327:16)
npm ERR! at IncomingMessage.emit (events.js:81:20)
npm ERR! at HTTPParser.onMessageComplete (http.js:133:23)
npm ERR! at CleartextStream.ondata (http.js:1228:22)
npm ERR! at CleartextStream._push (tls.js:303:27)
npm ERR! Report this *entire* log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>
npm ERR!
npm ERR! System Darwin 11.2.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "jquery"
npm ERR! cwd /Users/fw/nodeprojects/cloudnode/zorro
npm ERR! node -v v0.4.10
npm ERR! npm -v 1.0.106
npm ERR! type unexpected_token
npm ERR! arguments [ 'ILLEGAL' ]
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/fw/nodeprojects/cloudnode/zorro/npm-debug.log
npm not ok
答案 0 :(得分:10)
答案 1 :(得分:2)
似乎骆驼案例jQuery现在已经折旧了
npm WARN deprecated jQuery@1.7.4: This is deprecated. Please use 'jquery' (all lowercase).
你必须使用
npm install jquery
答案 2 :(得分:0)
在ubuntu上,我添加了&#39; sudo&#39;:
sudo npm install jquery
......为我解决了这个问题。
答案 3 :(得分:0)
要将jQuery包含在Node中,请先安装npm。
npm install jquery
要使jQuery在Node中工作,需要一个带有文档的窗口。由于Node本身不存在这样的窗口,因此可以使用jsdom之类的工具来模拟它。这对于进行测试很有用。
require("jsdom").env("", function(err, window) {
if (err) {
console.error(err);
return;
}
var $ = require("jquery")(window);
});