npm install gulp -g
npm install gulp --save-dev
npm install coffee-script --save-dev
---------------
1.2、官方网址:http://npm.taobao.org;
1.3安装:命令提示符执行npm install cnpm -g --registry=https://registry.npm.taobao.org; 注意:安装完后最好查看其版本号 cnpm -v或关闭命令提示符重新打开,安装完直接使用有可能会出现错误;
注:cnpm跟npm用法完全一致,只是在执行命令时将npm改为cnpm(以下操作将以cnpm 代替npm)。
2、全局安装gulp
安装方式:cnpm install gulp -g
----------------------
文件写权限问题,查看资料发现,可能需要增加--unsafe-perm,即
如:sudo npm install --unsafe-perm -g polymer-cli
1
首先清除根目录下的.node-gyp
卸载node-gyp模块
npm uninstall node-gyp -g
2
安装环境
npm i -g windows-build-tools
重新安装node-gyp
npm install -g node-gyp
3
设置python版本
npm config set python python
4
安装.net 2.0
5
安装vs 201* c++ 环境
6安装microtime运行时
npm i microtime --save-dev
------------------------
npm uninstall node-gyp -g
npm i -g windows-build-tools
npm install -g node-gyp
npm i -g node-inspector
npm cache clean --force
npm i -g pm2
-------
3.进入下面这个文件夹清除cache
路径:C:UsersPCAppDataRoamingnpm-cache
执行:
npm cache clean --force
----------
借助于pm2-windows-service 可以把pm2以windows服务运行。已服务运行的好处就是,即时用户注销也,pm2也会在后台运行
npm i pm2 -g
npm i pm2-windows-service -g
安装服务:pm2-service-install -n myservice (安装后在windows服务中多了一个myservice的服务)##卸载pm2-service-uninstall
设置环境变量:PM2_SERVICE_SCRIPTS = PM2的配置文件
windows服务中重新启动myservice服务
我们用vim关闭之后重新打开文件,会从第一行重新开始,但我们有时需要记忆上次编辑的内容
在vim /etc/vim/vimrc 有这一行被注释掉了
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
2、事件机制
node.js 使用事件驱动模型,当web server接收到请求,就把它关闭然后进行处理,然后去服务下一个web请求。当这个请求完成,它被放回处理队列,当到达队列开头,这个结果被返回给用户。在事件驱动模型中,会生成一个主循环来监听事件,当检测到事件时触发回调函数。
https://blog.csdn.net/zhouziyu2011/article/details/68928175
------------------
Node.js 异步编程的直接体现就是回调。
异步编程依托于回调来实现,但不能说使用了回调后程序就异步化了。
https://www.cnblogs.com/yitongjiangshan/p/5581316.html
-----------------------
A "callback" is any function that is called by another function which takes the first function as a parameter. (在一个函数中调用另外一个函数就是callback)
https://blog.csdn.net/rockage/article/details/79513450
-----------------
每个中间件的参数都是req,res,next. req中有一些请求的必要信息,以及有可能有上一个中间件的执行结果,res表示要返回给客户端的内容,next表示调用下一个中间件,只能在非结尾的中间件中使用
https://blog.csdn.net/u014595019/article/details/51019680
-----------------
七天学会NodeJS
https://lvtao.net/content/book/node.js.htm#1.6