nodejs 写文件pkg是什么文件

windows cygwin
node.js环境搭建 -
- ITeye技术网站
博客分类:
只做记录使用:
gcc-g++: C++ compiler
gcc-mingw-g++: Mingw32 support headers and libraries for GCC C++
gcc4-g++: G++ subpackage
git: Fast Version Control System – core files
make: The GNU version of the ‘make’ utility
openssl-devel: The OpenSSL development environment
pkg-config: A utility used to retrieve information about installed libraries
zlib-devel: The zlib compression/decompression library (development)
vim: Vi IMproved – enhanced vi editor
wget: Utility to retrieve files from the WWW via HTTP and FTP
curl: Multi-protocol file transfer command-line tool
接下来就是下载了,有朋友建议选择日本的镜像,挺快!然后就是漫长的等待了。
如果你是win7用户
进入cygwin安装目录下的bin子目录
运行ash.exe进入shell模式
./rebaseall -v
没有错误,完成,exit退出ash,关闭命令行窗口
第二步:安装Node.js
运行Cygwin
输入 wget http://nodejs.org/dist/node-v0.4.7.tar.gz 回车,下载node.js安装包。
输入 tar xf node-v0.4.7.tar.gz 回车。
输入 cd node-v0.4.7 回车。
输入 ./configure 回车。
输入 make 回车,可能要等一段时间!
输入 make install 回车。
一切正常的话,node.js安装成功!现在可以输入 node –version 回车,查看node.js版本啦
第三步:设置DNS并创建测试文件
cygwin的安装目录下找到etc文件夹,创建一个resolv.conf,添加代码:
nameserver 8.8.8.8nameserver 8.8.4.4
保存,关闭!
现在可以开始测试了,返回父目录,也就是cygwin的安装目录,新建一个js文件,命名test.js,输入:
varhttp = require('http');
http.createServer(function (request, response){
response.writeHead(200, {'Content-Type': 'text/html'});
response.end('&b&Hello World&/b&');
}).listen(8888);
console.log('Server running at http://127.0.0.1:8888/');
回到cygwin命令窗口中输入 node /example.js 回车。
命令窗口中显示 Server running at http://127.0.0.1:8888/
打开浏览器,输入http://127.0.0.1:8888/,成功了吧!
npm下载、安装、使用
npm是nodejs的软件包管理器,可以用它安装所需软件包并发布自己为nodejs写的软件包,它还管理软件包的依赖关系并做了其它一些很酷的事情。
一行命令下载并安装npm
$ curl http://npmjs.org/install.sh | sh
npm安装node扩展包,同样是一行命令下载并安装好软件包
$ npm install &包名&
xingkongxieyang
浏览: 33779 次
来自: 上海
ruiccc2013 写道大哥,别人写的错别字你都没看见哟,只 ...
大哥,别人写的错别字你都没看见哟,只知道一味的分享 ,这种精神 ...
哈哈 我第一个下载。
rentianchou 写道
大哥你嘛意思 ...

我要回帖

更多关于 nodejs文件操作 的文章

 

随机推荐