首页 > Web开发 > 详细

【nodejs】 npm 注意事项

时间:2015-07-01 11:42:51      阅读:226      评论:0      收藏:0      [点我收藏+]

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);
});
});

【nodejs】 npm 注意事项

原文:http://www.cnblogs.com/viewcozy/p/4612652.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!