1.安装时要切换到nodejs根目录, 否则就会安装到安装时所在的目录
2.要有管理员权限(win)
3.官方demo 提供比较全的依赖配置 http://www.hacksparrow.com/jquery-with-node-js.html
4.看一个demo
var $ = require(‘jquery‘);var http = require(‘http‘); var options = { host: ‘jquery.com‘, port: 80, path: ‘/‘}; var html = ‘‘;http.get(options, function(res) { res.on(‘data‘, function(data) { // collect the data chunks to the variable named "html" html += data; }).on(‘end‘, function() { // the whole of webpage data has been collected. parsing time! var title = $(html).find(‘title‘).text(); console.log(title); });});
时间: 2024-10-13 11:15:07