Initializing jquery from Node
问题 I am creating a new project using the following: $mkdir X $cd X $npm install jquery Then create a new app.js file: var http = require('http'); var $ = require('jquery'); console.log("http="+ http); console.log("$="+ $); console.log("$.getJSON="+ $.getJSON); Output is: http=[object Object] $=function ( w ) {...} $.getJSON=undefined Why is $.getJSON undefined ? Using latest io.js v2.4.0. 回答1: You are trying to create an XHR from within Node.js. This is not going to work since Node.js is simply