windows cygwin node.js环境搭建
只做记录使用:
cygwin:
?
Develgcc-g++: C++ compilergcc-mingw-g++: Mingw32 support headers and libraries for GCC C++gcc4-g++: G++ subpackagegit: Fast Version Control System – core filesmake: The GNU version of the ‘make’ utilityopenssl-devel: The OpenSSL development environmentpkg-config: A utility used to retrieve information about installed librarieszlib-devel: The zlib compression/decompression library (development)Editorvim: Vi IMproved – enhanced vi editorPython全部Web 分类wget: Utility to retrieve files from the WWW via HTTP and FTPcurl: Multi-protocol file transfer command-line tool接下来就是下载了,有朋友建议选择日本的镜像,挺快!然后就是漫长的等待了。
如果你是win7用户
一切正常的话,node.js安装成功!现在可以输入 node –version 回车,查看node.js版本啦
第三步:设置DNS并创建测试文件cygwin的安装目录下找到etc文件夹,创建一个resolv.conf,添加代码:
nameserver 8.8.8.8
nameserver 8.8.4.4
保存,关闭!
现在可以开始测试了,返回父目录,也就是cygwin的安装目录,新建一个js文件,命名test.js,输入:
回到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 <包名>