npm 安装相关环境及测试
2014-04-29 16:09
363 查看
0、npm 命令
1、安装express(全局)
npm install express -g(失败:express -v 报错:express: command not found)
npm install -g express-generator (成功:$ express -V 显示:4.0.0)
2、安装jade
npm install jade
3、安装mysql
npm install mysql
完毕后可以在nodejs\node_modules下看到express(失败的文件夹)/express-generator 、 jade、 mysql 、.bin这4个文件夹,并且.bin中应该有jade 和jade.cmd。
在nodejs下也会出现express.cmd(npm.cmd也在那里)。
4、在nodejs文件夹下创建一个项目myapp
express myapp
查看nodejs\myapp下的文件结构
$ ls
app.js bin package.json public routes views
5、复制node_modules到myapp下面(这个每次建一个项目都需要复制一次吗?)
参见:http://blog.csdn.net/lovesomnus/article/details/22731771
环境搭建到此完工,下面做一个demo测试!
在myapp下新建helloworld.js
Carrie@CARRIE-PC /c/Program Files/nodejs/myapp
$ node helloworld.js
nodejs start listen 8888 port!
打开http://127.0.0.1:8888/
出现:Hello World
C:\Users\Carrie>npm express Usage: npm <command> where <command> is one of: add-user, adduser, apihelp, author, bin, bugs, c, cache, completion, config, ddp, dedupe, deprecate, docs, edit, explore, faq, find, find-dupes, get, help, help-search, home, i, info, init, install, isntall, issues, la, link, list, ll, ln, login, ls, outdated, owner, pack, prefix, prune, publish, r, rb, rebuild, remove, repo, restart, rm, root, run-script, s, se, search, set, show, shrinkwrap, star, stars, start, stop, submodule, t, tag, test, tst, un, uninstall, unlink, unpublish, unstar, up, update, v, version, view, whoami npm <cmd> -h quick help on <cmd> npm -l display full usage info npm faq commonly asked questions npm help <term> search for help on <term> npm help npm involved overview
1、安装express(全局)
npm install express -g(失败:express -v 报错:express: command not found)
npm install -g express-generator (成功:$ express -V 显示:4.0.0)
2、安装jade
npm install jade
3、安装mysql
npm install mysql
完毕后可以在nodejs\node_modules下看到express(失败的文件夹)/express-generator 、 jade、 mysql 、.bin这4个文件夹,并且.bin中应该有jade 和jade.cmd。
在nodejs下也会出现express.cmd(npm.cmd也在那里)。
4、在nodejs文件夹下创建一个项目myapp
express myapp
查看nodejs\myapp下的文件结构
$ ls
app.js bin package.json public routes views
5、复制node_modules到myapp下面(这个每次建一个项目都需要复制一次吗?)
参见:http://blog.csdn.net/lovesomnus/article/details/22731771
环境搭建到此完工,下面做一个demo测试!
在myapp下新建helloworld.js
var http = require("http"); http.createServer(function(request, response) { response.writeHead(200, {"Content-Type": "text/plain"}); response.write("Hello World"); response.end(); }).listen(8888); console.log("nodejs start listen 8888 port!");
Carrie@CARRIE-PC /c/Program Files/nodejs/myapp
$ node helloworld.js
nodejs start listen 8888 port!
打开http://127.0.0.1:8888/
出现:Hello World
相关文章推荐
- CA根证书制作【仅供参考】-----win7 windows server 2008R2下 https SSL证书安装的搭配(搭配https ssl本地测试环境)
- (一)1.4JDK安装与环境变量配置及环境变量相关问题
- 在内网环境中安装npm
- Ubuntu 14.04 环境下在ROS安装测试Cartographer
- LNMP环境搭建:Nginx安装、测试与域名配置
- ubuntu14.04安装QT及相关开发环境
- mosquitto在Linux环境下的部署/安装/使用/测试
- Azure上搭建AD RMS环境系列二 -- RMS群集安装及内网测试
- 环境:ubuntu 下 javascrip 相关的 node 安装
- win 10系统下安装node/npm/webstrom环境遇到的问题及解决办法
- 在centos中安装jenkins master测试环境
- LINUX环境下SVN安装与配置(利用钩子同步开发环境与测试环境)
- 快速准备(复制替换)一套新测试环境,CentOS7 MySQL相关配置
- NodeJS、NPM安装配置步骤(windows版本) 以及环境变量
- 在fedora15的环境下编译与安装opencv,并测试人脸检测程序
- 在LNMP环境下安装测试HTTPS及其问题
- jmeter 在linux服务器的安装和运行; linux环境下使用jmeter进行压力测试
- SVM实现及Libsvm工具箱的安装测试(基于Matlab R204a环境)
- windows 10 环境安装caffe并测试mnist成功详解
- MHVTL安装--搭建备份软件测试环境的黄金搭档