Think before you speak, read before you think.

Category: NodeJS

  • npm taobao

    设置淘宝源 npm config set registry https://registry.npm.taobao.org 检查确认 cat ~/.npmrc registry=https://registry.npm.taobao.org

  • nodejs

    node 04 Modules Semantic Versioning version patch     “connect”: “~2.2.1”,     “underscore”: “~1.3.3” node 03 streams curl –upload-file abc.jpg http://localhost:3000 node 01 fs.readFileSync fs.readFile(‘/etc/hosts’, function(){}); setTimeout(function(){ console.log(“here we go”)}, 5000); // 等 5000ms 再运行 function non-blocking epxress 05 route instances app.route() chaining function single application file is too long extracting routes to modules var router…

  • node数据类型

    ➜ ~ node > var a = 1; undefined > typeof a ‘number’ > var b = {} undefined > typeof b ‘object’ > var c = function() {}; undefined > typeof c ‘function’ > var d = ”; undefined > typeof d ‘string’

  • npm使用淘宝的registry

    遇到过 forever 装不上的情况 /usr/bin/npm install forever -g 701 error Error: shasum check failed for /root/tmp/npm-5826-Ev6S_4GZ/1438247556786-0.7053809177596122/tmp.tgz 701 error Expected: 4353b88b7131797fb5520e39eba263df5863cba3 701 error Actual: 28322c7853c55e33081b19337d4e5359b8cceaae 701 error at /usr/lib/node_modules/sha/index.js:38:8 换成淘宝的registry后正常。 npm config set registry http://registry.npm.taobao.org/

  • nodejs-forever

    node.js的forever可保证进程挂掉之后重启,保证高可用 Monitors the script specified in the current process or as a daemon [Daemon]                                                                                   …

  • ubuntu安装配置nodejs

    安装nodejs,npm apt-get install nodejs apt-get install npm 编写hello.js var http = require(‘http’); http.createServer( function(req, res){ res.writeHead(200, {‘Content-Type’:’text/plain’}); res.end(‘hello node.js’); } ).listen(8124,”127.0.0.1″); console.log(‘Server running at http://127.0.0.1:8124/’); 运行 node hello.js 打开浏览器即可看到 hello node.js