Giter Site home page Giter Site logo

caio-ribeiro-pereira / livro-nodejs Goto Github PK

View Code? Open in Web Editor NEW
227.0 227.0 175.0 487 KB

Repositório público com códigos de exemplos do livro: Aplicações web real-time com Node.js

Home Page: https://casadocodigo.refersion.com/l/630.1389

JavaScript 29.99% CSS 56.62% HTML 0.65% EJS 12.74%

livro-nodejs's People

Contributors

caio-ribeiro-pereira avatar lpiedade avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

livro-nodejs's Issues

Sessão única para cada usuário

Eu constatei que a sessão não é única para cada novo usuário e por isso os exemplos não estão funcionando corretamente, pois o usuário da sessão é sempre sobrescrito com o último a logar no sistema, mesmo no projeto pronto do seu repositório. Tem algum passo pra que esse problema seja resolvido que talvez eu tenha pulado?

EDIT: Reparei que com uma janela normal e uma em modo privado funciona.. Mas duas iguais (normais ou privadas) não vai..

6.3 Implementando um chat real-time

Caio,

O package Socket.io não está servindo o arquivo socket.io.js, meu código está igual ao seu até a página 122.

Não sei se é um problema com a versão da biblioteca ("socket.io": "^1.0.6").

Obrigado!

Capitulo 4 - Aplicação de Chat não starta

Olha eu denovo hehe!

agora tento rodar a aplicação conforme ensinado no livro dessa forma:

cd ntalk
npm start

mas parece q éh lançada uma exceção/erro
olha o log

0 info it worked if it ends with ok
1 verbose cli [ 'c:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'c:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start' ]
2 info using npm@2.14.20
3 info using node@v4.4.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info prestart ntalk@1.0.0
6 info start ntalk@1.0.0
7 verbose unsafe-perm in lifecycle true
8 info ntalk@1.0.0 Failed to exec start script
9 verbose stack Error: ntalk@1.0.0 start: `node server`
9 verbose stack Exit status 1
9 verbose stack     at EventEmitter.<anonymous> (c:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:214:16)
9 verbose stack     at emitTwo (events.js:87:13)
9 verbose stack     at EventEmitter.emit (events.js:172:7)
9 verbose stack     at ChildProcess.<anonymous> (c:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
9 verbose stack     at emitTwo (events.js:87:13)
9 verbose stack     at ChildProcess.emit (events.js:172:7)
9 verbose stack     at maybeClose (internal/child_process.js:827:16)
9 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
10 verbose pkgid ntalk@1.0.0
11 verbose cwd d:\livro-nodejs\projeto\ntalk
12 error Windows_NT 6.3.9600
13 error argv "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
14 error node v4.4.0
15 error npm  v2.14.20
16 error code ELIFECYCLE
17 error ntalk@1.0.0 start: `node server`
17 error Exit status 1
18 error Failed at the ntalk@1.0.0 start script 'node server'.
18 error This is most likely a problem with the ntalk package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error     node server
18 error You can get information on how to open an issue for this project with:
18 error     npm bugs ntalk
18 error Or if that isn't available, you can get their info via:
18 error
18 error     npm owner ls ntalk
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]

tem até um print do meu cmd :)

node_error

Erro ao exibir dados do array na tela

Bom dia, Caio!

A minha dúvida é a seguinte: após efetuar login, cair na página index dos contatos (onde é possível adicionar através de um formulário e consultar os itens adicionados numa tabela abaixo), ao adicionar, recebo o seguinte erro:

[...]
TypeError: C:\Users\Nelson\Documents\Projetos\LivroNodeJS\ntalk\views\contatos\index.ejs:25
23| <% contatos.forEach((contato, index) => { %>

24|                     <tr>

25| <%- contato.nome %>

26|                         <td><%- contato.email %></td>

27|                         <td>

28|                             <a href="/contato/<%- index %>">Detalhes</a>

Cannot read property 'nome' of null
at contatos.forEach (eval at compile (C:\Users\Nelson\Documents\Projetos\LivroNodeJS\ntalk\node_modules\ejs\lib\ejs.js:592:12), :25:25)
at Array.forEach ()
at eval (eval at compile
[...]

As Actions responsáveis por essa página seguem abaixo:

    index: function(req, res) {
        const { usuario } = req.session;
        const { contatos } = usuario;
        res.render('contatos/index', { usuario, contatos });
    },
    create: function(req, res) {
        const { contato } = req.body;
        const { usuario } = req.session;
        usuario.contatos.push(contato);
        res.redirect('/contatos');
    }

Fucei de todas as formas e não obtive sucesso... Recorro a você para que eu possa continuar meus estudos.

Um abraço!

Cap. 6 client.on('join')

Ao finalizar o cap 6 os usuários não conseguem entrar na mesma "sala" criada através do hash.
A função client.on('join') não recebe uma sala pelo parâmetro e sempre cria uma nova. Isso deve acontecer pq quando a sala é criada pelo primeiro que entra não é atualizado a sala para o outro usuário para que este então possa entrar dentro da mesma sala.

Alguma idéia de onde isto pode estar falhando? Obrigado.

Pagina 44

Caio,

Na pagina 44 tem um trecho que pede para criar o arquivo routes/home.js, porém não informa para criar o arquivo controllers/home.js com o trecho abaixo:

module.exports = function(app) {
var HomeController = {
index: function(req, res) {
res.render('home/index');
} };
return HomeController;
};

Trecho do Livro:
Repare que por causa do express-load, a variável app já possui um su- bobjeto chamado controllers. Neste caso, o app.controllers.home está se referenciando ao arquivo
module.exports = function(app) {
var HomeController = {
index: function(req, res) {
res.render('home/index');
} };
return HomeController;
};

Express 4

@caio-ribeiro-pereira
Existe a possibilidade de rolar uma atualização do código para o express v4? Andei estudando e houveram algumas alterações, principalmente com o uso do express.Router() para definição de rotas.

E outra questão, pelo que andei olhando nos tutoriais, não achei nenhum que usasse a abordagem de controllers, normalmente o pessoal deixa toda a lógica dentro do próprio arquivo de rotas. Existe uma melhor prática? Vi um pessoal defendendo a prática citada pelo fato de centralizar a lógica em um único lugar, mas achei interessante a tua abordagem, parece mais organizado.

Abraço.

Detalhe Capítulo 6. Programando sistemas real-time

Boa noite Caio, tudo bom?

Passando pelo capítulo 6, pagina 79, onde você orienta a colocar o seguinte código no app.js:

io.set(function(socket, next) {
var data = socket.request;
cookie(data, {}, function(err) {
var sessionID = data.signedCookies[KEY];
store.get(sessionID, function(err, session) {
if (err || !session) {
return next(new Error('acesso negado'));
} else {
socket.handshake.session = session;
return next();
}
});
});
});

Só que tem um detalhe, na minha aplicação não estava dando certo foi ae que alterei de
io.set para io.use ficando assim:

io.use(function(socket, next) {
var data = socket.request;
cookie(data, {}, function(err) {
var sessionID = data.signedCookies[KEY];
store.get(sessionID, function(err, session) {
if (err || !session) {
return next(new Error('acesso negado'));
} else {
socket.handshake.session = session;
return next();
}
});
});
});

desta maneira funcionou.

Agradeço.

Erro ao instalar o hiredis

$ npm install hiredis --save                                                  
npm http GET https://registry.npmjs.org/hiredis
npm http 304 https://registry.npmjs.org/hiredis
npm http GET https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/bindings

> [email protected] install /home/calazans/Projects/personal/ntalk/node_modules/hiredis
> node-gyp rebuild

gyp ERR! configure error 
gyp ERR! stack Error: Python executable "python" is v3.4.0, which is not supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.
gyp ERR! stack     at failPythonVersion (/home/calazans/.nvm/v0.10.26/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:106:14)
gyp ERR! stack     at /home/calazans/.nvm/v0.10.26/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:95:9
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:635:7)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at maybeClose (child_process.js:743:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:810:5)
gyp ERR! System Linux 3.13.8-1-ARCH
gyp ERR! command "node" "/home/calazans/.nvm/v0.10.26/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/calazans/Projects/personal/ntalk/node_modules/hiredis
gyp ERR! node -v v0.10.26
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok 
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the hiredis package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls hiredis
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.13.8-1-ARCH
npm ERR! command "node" "/home/calazans/.nvm/v0.10.26/bin/npm" "install" "hiredis" "--save"
npm ERR! cwd /home/calazans/Projects/personal/ntalk
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.4
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/calazans/Projects/personal/ntalk/npm-debug.log
npm ERR! not ok code 0

Capitulo 6 - io is not defined

Fala caio, seguindo o exemplo inicial do socket.io na pagina 73-74. Obtenho sempre 404 sobre a chamada <script src="/socket.io/socket.io.js"></script> e consequentemente a mensagem "io is not defined". Em uma pesquisa rápida vi algumas sugestões para adicionar localhost:3000 na chamada do js, mas também não funcionou. O meu app.js seguiu a evolução que o livro propôs. Segue abaixo:

var express = require('express')
, load = require('express-load')
, bodyParser = require('body-parser')
, cookieParser = require('cookie-parser')
, expressSession = require('express-session')
, methodOverride = require('method-override')
, error = require('./middlewares/error')
, app = express()
, server = require('http').Server(app)
, io = require('socket.io')(server);

app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
app.use(cookieParser('ntalk'));
app.use(expressSession());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));
app.use(methodOverride('_method'));
app.use(express.static(__dirname + '/public'));

load('models')
.then('controllers')
.then('routes')
.into(app);

io.sockets.on('connection', function(client){
    client.on('send-server', function(data){
        var msg = "<b>" + data.nome + ": </b>" + data.msg + "<br>";
        client.emit('send-client', msg);
        client.broadcast.emit('send-client', msg);
    });
});

app.use(error.notFound);
app.use(error.serverError);

app.listen(3000, function(){
  console.log("Ntalk no ar.");
});

Abs.

Dois erros de execução no Windows 10

Olá Caio baixei o projeto NTALK para minha pasta do Git,** mas quando ao executar o comando "npm start" o Win 10 apresenta o seguinte erro:**

node server

events.js:154
throw er; // Unhandled 'error' event
^

Error: spawn C:\Program ENOENT
at exports._errnoException (util.js:890:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:182:32)
at onErrorNT (internal/child_process.js:348:16)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
at Function.Module.runMain (module.js:449:11)
at startup (node.js:146:18)
at node.js:404:3

npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "start"
npm ERR! node v5.10.1
npm ERR! npm v3.8.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: node server
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node server'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ntalk package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node server
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs ntalk
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls ntalk
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Victorugo\Documents\GitHub\naulas\ntalk\npm-debug.log

C:\Users\Victorugo\Documents\GitHub\naulas\ntalk>

Quando ao executar o comando "node app.js" o Win 10 apresenta o seguinte erro:

C:\Users\Victorugo\Documents\GitHub\naulas\ntalk>node app.js
{ [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version
Ntalk no ar.
events.js:154
throw er; // Unhandled 'error' event
^

Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379
at RedisClient.on_error (C:\Users\Victorugo\Documents\GitHub\naulas\ntalk\node_modules\socket.io-redis\node_modules\redis\index.js:185:24)
at Socket. (C:\Users\Victorugo\Documents\GitHub\naulas\ntalk\node_modules\socket.io-redis\node_modules\redis\index.js:95:14)
at emitOne (events.js:90:13)
at Socket.emit (events.js:182:7)
at emitErrorNT (net.js:1249:8)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)

O caminho do projeto é seguinte: C:\Users\Victorugo\Documents\GitHub\naulas\ntalk>

Agradeço sua atenção e aguardo help...

Problema no capitulo 4

No capitulo 4 só consegui fazer o código funcionar colocando:

res.render('../views/home/index');

...mas não entendi o por que do '../'

nas dependencias estou usando:

"express": "3.3.5",
"ejs": "*",
"express-load": "*"

alguem sabe qual seria o problema ?

Projeto não roda após a implementação dos contatos (capítulo 5.2)

Após implementar a parte dos contatos, antes de começar a parte 5.3, o projeto nao roda e retorna os seguintes erros no terminal:

OBS: O código está exatamente como o livro mostra até essa parte

/var/www/html/node/ntalk/node_modules/express/lib/express.js:89
      throw new Error('Most middleware (like ' + name + ') is no longer bundled with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middleware.');
      ^

Error: Most middleware (like cookieParser) is no longer bundled with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middleware.
    at Function.get (/var/www/html/node/ntalk/node_modules/express/lib/express.js:89:13)
    at Object.<anonymous> (/var/www/html/node/ntalk/app.js:8:16)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:427:7)
    at startup (bootstrap_node.js:151:9)

Capitulo 4 - Configuração de Rotas

Ola Caio, bom dia !

Durante o passo a passo em que voce ensina a realizar a primeira configuração de Rota, após segui os passos e rodo o comando node app.js, é exibida a mensagem "Ntalk no ar", no entanto ao acessar Localhost:3000 é exibido a mensagem "Cannot GET"

Consegue me ajudar ?

Olá

estou usando o express 2.5.8

quando uso o comando o comando express ntalk --ejs , é criado um projeto de nome --ejs com dependecia jade

Capitulo 9

Olá Caio tudo bem?
Mais uma vez aqui.
Seguinte, no capitulo 9 na pagina 134, 9.5 Otimizações no Express você refatora o arquivo app.js e nesta refatoração referencia o arquivo redis_connect.js neste import:
"redisConnect = require(’./libs/redis_connect’)" , só que em nenhum momento do livro você cita a criação de tal arquivo.
Consegui o arquivo no seu github do livro.

Abraços.

Problema com Comunicação one-to-one Cap 6.8

@caio-ribeiro-pereira tudo bem? Estou seguindo meus estudos com o seu livro (parabéns, sou programador Java e estou conseguindo aprender bastante sobre node com ele etc.)

Porém, estou com um problema no Cap. 6.8, onde temos que fazer com que cada sala mantenha uma conversa com apenas 2 contatos, que ele crie uma sala. O problema acontece na hora de enviar a mensagem, porém não aparece nenhum erro nem no console do mac, nem no do browser.

Se quiser, da uma olhada no meu código: https://github.com/pedro-hos/courses/tree/master/node/ntalk

Agradeço desde já.

Erro ao tentar rodar o Projeto do cap4

depois de clonar o repositorio eu executei

cd ntalk
npm install

no terminal a mensagem de erro em vermelhor foi:

Arquivo de solução error MSB5004 : O arquivo de solução tem dois projetos denominados "hiredis.sln"

e gerou esse arquivo de log!

0 info it worked if it ends with ok
1 verbose cli [ 'c:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'c:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install' ]
2 info using [email protected]
3 info using [email protected]
4 verbose readDependencies loading dependencies from d:\livro-nodejs\projeto\ntalk\package.json
5 verbose install where, deps [ 'd:\\livro-nodejs\\projeto\\ntalk',
5 verbose install   [ 'body-parser',
5 verbose install     'compression',
5 verbose install     'connect-redis',
5 verbose install     'cookie-parser',
5 verbose install     'csurf',
5 verbose install     'ejs',
5 verbose install     'express',
5 verbose install     'express-load',
5 verbose install     'express-session',
5 verbose install     'forever-monitor',
5 verbose install     'hiredis',
5 verbose install     'method-override',
5 verbose install     'mongoose',
5 verbose install     'redis',
5 verbose install     'socket.io',
5 verbose install     'socket.io-redis',
5 verbose install     'mocha',
5 verbose install     'should',
5 verbose install     'supertest' ] ]
6 verbose install where, peers [ 'd:\\livro-nodejs\\projeto\\ntalk', [] ]
7 verbose installManyTop reading for lifecycle d:\livro-nodejs\projeto\ntalk\package.json
8 info preinstall [email protected]
9 verbose installManyTop reading scoped package data from d:\livro-nodejs\projeto\ntalk\node_modules\body-parser\package.json
10 verbose installManyTop reading scoped package data from d:\livro-nodejs\projeto\ntalk\node_modules\compression\package.json
11 verbose installManyTop reading scoped package data from d:\livro-nodejs\projeto\ntalk\node_modules\connect-redis\package.json
12 verbose installManyTop reading scoped package data from d:\livro-nodejs\projeto\ntalk\node_modules\cookie-parser\package.json
13 verbose installManyTop reading scoped package data from d:\livro-nodejs\projeto\ntalk\node_modules\csurf\package.json
14 verbose installManyTop reading scoped package data from d:\livro-nodejs\projeto\ntalk\node_modules\ejs\package.json
15 verbose installManyTop reading scoped package data from d:\livro-nodejs\projeto\ntalk\node_modules\express\package.json
16 verbose installManyTop reading scoped package data from d:\livro-nodejs\projeto\ntalk\node_modules\express-load\package.json
17 verbose installManyTop reading scoped package data from d:\livro-nodejs\projeto\ntalk\node_modules\express-session\package.json
18 verbose installManyTop reading scoped package data from d:\livro-nodejs\projeto\ntalk\node_modules\forever-monitor\package.json
19 verbose installManyTop reading scoped package data from d:\livro-nodejs\projeto\ntalk\node_modules\method-override\package.json
20 verbose installManyTop reading scoped package data from d:\livro-nodejs\projeto\ntalk\node_modules\mocha\package.json
21 verbose installManyTop reading scoped package data from d:\livro-nodejs\projeto\ntalk\node_modules\mongoose\package.json
22 verbose installManyTop reading scoped package data from d:\livro-nodejs\projeto\ntalk\node_modules\redis\package.json
23 verbose installManyTop reading scoped package data from d:\livro-nodejs\projeto\ntalk\node_modules\should\package.json
24 verbose installManyTop reading scoped package data from d:\livro-nodejs\projeto\ntalk\node_modules\socket.io\package.json
25 verbose installManyTop reading scoped package data from d:\livro-nodejs\projeto\ntalk\node_modules\socket.io-redis\package.json
26 verbose installManyTop reading scoped package data from d:\livro-nodejs\projeto\ntalk\node_modules\supertest\package.json
27 info package.json [email protected] No license field.
28 info package.json [email protected] No license field.
29 info package.json [email protected] No license field.
30 info package.json [email protected] No license field.
31 info package.json [email protected] No license field.
32 info package.json [email protected] No license field.
33 info package.json [email protected] No license field.
34 info package.json [email protected] No license field.
35 verbose readDependencies loading dependencies from d:\livro-nodejs\projeto\ntalk\package.json
36 verbose targetResolver reading package data from d:\livro-nodejs\projeto\ntalk\node_modules\body-parser\package.json
37 verbose targetResolver reading package data from d:\livro-nodejs\projeto\ntalk\node_modules\compression\package.json
38 verbose targetResolver reading package data from d:\livro-nodejs\projeto\ntalk\node_modules\connect-redis\package.json
39 verbose targetResolver reading package data from d:\livro-nodejs\projeto\ntalk\node_modules\cookie-parser\package.json
40 verbose targetResolver reading package data from d:\livro-nodejs\projeto\ntalk\node_modules\csurf\package.json
41 verbose targetResolver reading package data from d:\livro-nodejs\projeto\ntalk\node_modules\ejs\package.json
42 verbose targetResolver reading package data from d:\livro-nodejs\projeto\ntalk\node_modules\express\package.json
43 verbose targetResolver reading package data from d:\livro-nodejs\projeto\ntalk\node_modules\express-load\package.json
44 verbose targetResolver reading package data from d:\livro-nodejs\projeto\ntalk\node_modules\express-session\package.json
45 verbose targetResolver reading package data from d:\livro-nodejs\projeto\ntalk\node_modules\forever-monitor\package.json
46 verbose targetResolver reading package data from d:\livro-nodejs\projeto\ntalk\node_modules\method-override\package.json
47 verbose targetResolver reading package data from d:\livro-nodejs\projeto\ntalk\node_modules\mocha\package.json
48 verbose targetResolver reading package data from d:\livro-nodejs\projeto\ntalk\node_modules\mongoose\package.json
49 verbose targetResolver reading package data from d:\livro-nodejs\projeto\ntalk\node_modules\redis\package.json
50 verbose targetResolver reading package data from d:\livro-nodejs\projeto\ntalk\node_modules\should\package.json
51 verbose targetResolver reading package data from d:\livro-nodejs\projeto\ntalk\node_modules\socket.io\package.json
52 verbose targetResolver reading package data from d:\livro-nodejs\projeto\ntalk\node_modules\socket.io-redis\package.json
53 verbose targetResolver reading package data from d:\livro-nodejs\projeto\ntalk\node_modules\supertest\package.json
54 verbose targetResolver reading package data from d:\livro-nodejs\projeto\ntalk\node_modules\.bin\mocha\package.json
55 verbose targetResolver reading package data from d:\livro-nodejs\projeto\ntalk\node_modules\.bin\mocha.cmd\package.json
56 verbose already installed skipping express-load@~1.1.14 d:\livro-nodejs\projeto\ntalk
57 verbose already installed skipping express-session@~1.6.5 d:\livro-nodejs\projeto\ntalk
58 verbose already installed skipping forever-monitor@~1.2.3 d:\livro-nodejs\projeto\ntalk
59 silly cache add args [ 'hiredis@~0.1.17', null ]
60 verbose cache add spec hiredis@~0.1.17
61 silly cache add parsed spec Result {
61 silly cache add   raw: 'hiredis@~0.1.17',
61 silly cache add   scope: null,
61 silly cache add   name: 'hiredis',
61 silly cache add   rawSpec: '~0.1.17',
61 silly cache add   spec: '>=0.1.17 <0.2.0',
61 silly cache add   type: 'range' }
62 silly addNamed hiredis@>=0.1.17 <0.2.0
63 verbose addNamed ">=0.1.17 <0.2.0" is a valid semver range for hiredis
64 silly addNameRange { name: 'hiredis', range: '>=0.1.17 <0.2.0', hasData: false }
65 silly mapToRegistry name hiredis
66 silly mapToRegistry using default registry
67 silly mapToRegistry registry https://registry.npmjs.org/
68 silly mapToRegistry uri https://registry.npmjs.org/hiredis
69 verbose addNameRange registry:https://registry.npmjs.org/hiredis not in flight; fetching
70 verbose already installed skipping method-override@~2.1.1 d:\livro-nodejs\projeto\ntalk
71 verbose already installed skipping mongoose@~3.8.13 d:\livro-nodejs\projeto\ntalk
72 verbose already installed skipping redis@~0.11.0 d:\livro-nodejs\projeto\ntalk
73 verbose already installed skipping socket.io@^1.2.1 d:\livro-nodejs\projeto\ntalk
74 verbose already installed skipping socket.io-redis@^0.1.4 d:\livro-nodejs\projeto\ntalk
75 verbose already installed skipping mocha@~1.20.1 d:\livro-nodejs\projeto\ntalk
76 verbose request uri https://registry.npmjs.org/hiredis
77 verbose request no auth needed
78 info attempt registry request try #1 at 16:20:01
79 verbose request id 352068091f8cb32b
80 verbose etag "DZ9Y9UR1ZE0XKKCEZ8I6EYVOB"
81 http request GET https://registry.npmjs.org/hiredis
82 verbose already installed skipping should@~4.0.4 d:\livro-nodejs\projeto\ntalk
83 verbose already installed skipping supertest@~0.13.0 d:\livro-nodejs\projeto\ntalk
84 verbose already installed skipping body-parser@~1.4.3 d:\livro-nodejs\projeto\ntalk
85 verbose already installed skipping compression@~1.0.8 d:\livro-nodejs\projeto\ntalk
86 verbose already installed skipping connect-redis@~2.0.0 d:\livro-nodejs\projeto\ntalk
87 verbose already installed skipping cookie-parser@~1.3.2 d:\livro-nodejs\projeto\ntalk
88 verbose already installed skipping csurf@~1.3.0 d:\livro-nodejs\projeto\ntalk
89 verbose already installed skipping ejs@~1.0.0 d:\livro-nodejs\projeto\ntalk
90 verbose already installed skipping express@~4.6.1 d:\livro-nodejs\projeto\ntalk
91 http 304 https://registry.npmjs.org/hiredis
92 verbose headers { date: 'Tue, 15 Mar 2016 19:20:02 GMT',
92 verbose headers   via: '1.1 varnish',
92 verbose headers   'cache-control': 'max-age=300',
92 verbose headers   etag: '"DZ9Y9UR1ZE0XKKCEZ8I6EYVOB"',
92 verbose headers   age: '245',
92 verbose headers   connection: 'keep-alive',
92 verbose headers   'x-served-by': 'cache-iad2128-IAD',
92 verbose headers   'x-cache': 'HIT',
92 verbose headers   'x-cache-hits': '1',
92 verbose headers   'x-timer': 'S1458069602.040029,VS0,VE0',
92 verbose headers   vary: 'Accept' }
93 silly get cb [ 304,
93 silly get   { date: 'Tue, 15 Mar 2016 19:20:02 GMT',
93 silly get     via: '1.1 varnish',
93 silly get     'cache-control': 'max-age=300',
93 silly get     etag: '"DZ9Y9UR1ZE0XKKCEZ8I6EYVOB"',
93 silly get     age: '245',
93 silly get     connection: 'keep-alive',
93 silly get     'x-served-by': 'cache-iad2128-IAD',
93 silly get     'x-cache': 'HIT',
93 silly get     'x-cache-hits': '1',
93 silly get     'x-timer': 'S1458069602.040029,VS0,VE0',
93 silly get     vary: 'Accept' } ]
94 verbose etag https://registry.npmjs.org/hiredis from cache
95 verbose get saving hiredis to C:\Users\ti-02\AppData\Roaming\npm-cache\registry.npmjs.org\hiredis\.cache.json
96 verbose correctMkdir C:\Users\ti-02\AppData\Roaming\npm-cache correctMkdir not in flight; initializing
97 silly addNameRange number 2 { name: 'hiredis', range: '>=0.1.17 <0.2.0', hasData: true }
98 silly addNameRange versions [ 'hiredis',
98 silly addNameRange   [ '0.1.0',
98 silly addNameRange     '0.1.1',
98 silly addNameRange     '0.1.2',
98 silly addNameRange     '0.1.3',
98 silly addNameRange     '0.1.4',
98 silly addNameRange     '0.1.5',
98 silly addNameRange     '0.1.6',
98 silly addNameRange     '0.1.8',
98 silly addNameRange     '0.1.9',
98 silly addNameRange     '0.1.10',
98 silly addNameRange     '0.1.12',
98 silly addNameRange     '0.1.13',
98 silly addNameRange     '0.1.14',
98 silly addNameRange     '0.1.15',
98 silly addNameRange     '0.1.16',
98 silly addNameRange     '0.1.17',
98 silly addNameRange     '0.2.0',
98 silly addNameRange     '0.3.0',
98 silly addNameRange     '0.4.0',
98 silly addNameRange     '0.4.1' ] ]
99 silly addNamed [email protected]
100 verbose addNamed "0.1.17" is a plain semver version for hiredis
101 silly cache afterAdd [email protected]
102 verbose afterAdd C:\Users\ti-02\AppData\Roaming\npm-cache\hiredis\0.1.17\package\package.json not in flight; writing
103 verbose correctMkdir C:\Users\ti-02\AppData\Roaming\npm-cache correctMkdir not in flight; initializing
104 verbose afterAdd C:\Users\ti-02\AppData\Roaming\npm-cache\hiredis\0.1.17\package\package.json written
105 silly install resolved [ { name: 'hiredis',
105 silly install resolved     description: 'Wrapper for reply processing code in hiredis',
105 silly install resolved     version: '0.1.17',
105 silly install resolved     homepage: 'http://github.com/redis/hiredis-node',
105 silly install resolved     author: { name: 'Pieter Noordhuis', email: '[email protected]' },
105 silly install resolved     main: 'hiredis',
105 silly install resolved     scripts: { test: 'node test/reader.js', install: 'node-gyp rebuild' },
105 silly install resolved     dependencies: { bindings: '*', nan: '~1.1.0' },
105 silly install resolved     engines: { node: '>= 0.6.0' },
105 silly install resolved     repository:
105 silly install resolved      { type: 'git',
105 silly install resolved        url: 'git+https://github.com/redis/hiredis-node.git' },
105 silly install resolved     bugs: { url: 'https://github.com/redis/hiredis-node/issues' },
105 silly install resolved     licenses: [ [Object] ],
105 silly install resolved     gypfile: true,
105 silly install resolved     _id: '[email protected]',
105 silly install resolved     _shasum: '60a33a968efc9a974e7ebb832f33aa965d3d354e',
105 silly install resolved     _resolved: 'https://registry.npmjs.org/hiredis/-/hiredis-0.1.17.tgz',
105 silly install resolved     _from: 'hiredis@>=0.1.17 <0.2.0',
105 silly install resolved     _npmVersion: '1.4.9',
105 silly install resolved     _npmUser: { name: 'pietern', email: '[email protected]' },
105 silly install resolved     maintainers: [ [Object] ],
105 silly install resolved     dist:
105 silly install resolved      { shasum: '60a33a968efc9a974e7ebb832f33aa965d3d354e',
105 silly install resolved        tarball: 'http://registry.npmjs.org/hiredis/-/hiredis-0.1.17.tgz' },
105 silly install resolved     directories: {},
105 silly install resolved     readme: 'ERROR: No README data found!' } ]
106 info install [email protected] into d:\livro-nodejs\projeto\ntalk
107 info installOne [email protected]
108 verbose installOne of hiredis to d:\livro-nodejs\projeto\ntalk not in flight; installing
109 verbose correctMkdir C:\Users\ti-02\AppData\Roaming\npm-cache\_locks correctMkdir not in flight; initializing
110 verbose lock using C:\Users\ti-02\AppData\Roaming\npm-cache\_locks\hiredis-9e61669142282db0.lock for d:\livro-nodejs\projeto\ntalk\node_modules\hiredis
111 silly install write writing hiredis 0.1.17 to d:\livro-nodejs\projeto\ntalk\node_modules\hiredis
112 verbose unbuild node_modules\hiredis
113 silly gentlyRm d:\livro-nodejs\projeto\ntalk\node_modules\hiredis is being purged from base d:\livro-nodejs\projeto\ntalk
114 verbose gentlyRm don't care about contents; nuking d:\livro-nodejs\projeto\ntalk\node_modules\hiredis
115 verbose tar unpack C:\Users\ti-02\AppData\Roaming\npm-cache\hiredis\0.1.17\package.tgz
116 verbose tar unpacking to d:\livro-nodejs\projeto\ntalk\node_modules\hiredis
117 silly gentlyRm d:\livro-nodejs\projeto\ntalk\node_modules\hiredis is being purged
118 verbose gentlyRm don't care about contents; nuking d:\livro-nodejs\projeto\ntalk\node_modules\hiredis
119 silly gunzTarPerm modes [ '777', '666' ]
120 silly gunzTarPerm extractEntry
121 silly gunzTarPerm modified mode [ '', 493, 511 ]
122 silly gunzTarPerm extractEntry bench.js
123 silly gunzTarPerm modified mode [ 'bench.js', 420, 438 ]
124 silly gunzTarPerm extractEntry binding.gyp
125 silly gunzTarPerm modified mode [ 'binding.gyp', 420, 438 ]
126 silly gunzTarPerm extractEntry COPYING
127 silly gunzTarPerm modified mode [ 'COPYING', 420, 438 ]
128 silly gunzTarPerm extractEntry deps/
129 silly gunzTarPerm modified mode [ 'deps/', 493, 511 ]
130 silly gunzTarPerm extractEntry hiredis.js
131 silly gunzTarPerm modified mode [ 'hiredis.js', 420, 438 ]
132 silly gunzTarPerm extractEntry package.json
133 silly gunzTarPerm modified mode [ 'package.json', 420, 438 ]
134 silly gunzTarPerm extractEntry README.md
135 silly gunzTarPerm modified mode [ 'README.md', 420, 438 ]
136 silly gunzTarPerm extractEntry src/
137 silly gunzTarPerm modified mode [ 'src/', 493, 511 ]
138 silly gunzTarPerm extractEntry test/
139 silly gunzTarPerm modified mode [ 'test/', 493, 511 ]
140 silly gunzTarPerm extractEntry test/reader.js
141 silly gunzTarPerm modified mode [ 'test/reader.js', 420, 438 ]
142 silly gunzTarPerm extractEntry src/hiredis.cc
143 silly gunzTarPerm modified mode [ 'src/hiredis.cc', 420, 438 ]
144 silly gunzTarPerm extractEntry src/reader.cc
145 silly gunzTarPerm modified mode [ 'src/reader.cc', 420, 438 ]
146 silly gunzTarPerm extractEntry src/reader.h
147 silly gunzTarPerm modified mode [ 'src/reader.h', 420, 438 ]
148 silly gunzTarPerm extractEntry deps/hiredis/
149 silly gunzTarPerm modified mode [ 'deps/hiredis/', 493, 511 ]
150 silly gunzTarPerm extractEntry deps/hiredis.gyp
151 silly gunzTarPerm modified mode [ 'deps/hiredis.gyp', 420, 438 ]
152 silly gunzTarPerm extractEntry deps/hiredis/adapters/
153 silly gunzTarPerm modified mode [ 'deps/hiredis/adapters/', 493, 511 ]
154 silly gunzTarPerm extractEntry deps/hiredis/async.c
155 silly gunzTarPerm modified mode [ 'deps/hiredis/async.c', 420, 438 ]
156 silly gunzTarPerm extractEntry deps/hiredis/async.h
157 silly gunzTarPerm modified mode [ 'deps/hiredis/async.h', 420, 438 ]
158 silly gunzTarPerm extractEntry deps/hiredis/CHANGELOG.md
159 silly gunzTarPerm modified mode [ 'deps/hiredis/CHANGELOG.md', 420, 438 ]
160 silly gunzTarPerm extractEntry deps/hiredis/COPYING
161 silly gunzTarPerm modified mode [ 'deps/hiredis/COPYING', 420, 438 ]
162 silly gunzTarPerm extractEntry deps/hiredis/dict.c
163 silly gunzTarPerm modified mode [ 'deps/hiredis/dict.c', 420, 438 ]
164 silly gunzTarPerm extractEntry deps/hiredis/dict.h
165 silly gunzTarPerm modified mode [ 'deps/hiredis/dict.h', 420, 438 ]
166 silly gunzTarPerm extractEntry deps/hiredis/example-ae.c
167 silly gunzTarPerm modified mode [ 'deps/hiredis/example-ae.c', 420, 438 ]
168 silly gunzTarPerm extractEntry deps/hiredis/example-libev.c
169 silly gunzTarPerm modified mode [ 'deps/hiredis/example-libev.c', 420, 438 ]
170 silly gunzTarPerm extractEntry deps/hiredis/example-libevent.c
171 silly gunzTarPerm modified mode [ 'deps/hiredis/example-libevent.c', 420, 438 ]
172 silly gunzTarPerm extractEntry deps/hiredis/example.c
173 silly gunzTarPerm modified mode [ 'deps/hiredis/example.c', 420, 438 ]
174 silly gunzTarPerm extractEntry deps/hiredis/fmacros.h
175 silly gunzTarPerm modified mode [ 'deps/hiredis/fmacros.h', 420, 438 ]
176 silly gunzTarPerm extractEntry deps/hiredis/hiredis.c
177 silly gunzTarPerm modified mode [ 'deps/hiredis/hiredis.c', 420, 438 ]
178 silly gunzTarPerm extractEntry deps/hiredis/hiredis.h
179 silly gunzTarPerm modified mode [ 'deps/hiredis/hiredis.h', 420, 438 ]
180 silly gunzTarPerm extractEntry deps/hiredis/Makefile
181 silly gunzTarPerm modified mode [ 'deps/hiredis/Makefile', 420, 438 ]
182 silly gunzTarPerm extractEntry deps/hiredis/net.c
183 silly gunzTarPerm modified mode [ 'deps/hiredis/net.c', 420, 438 ]
184 silly gunzTarPerm extractEntry deps/hiredis/net.h
185 silly gunzTarPerm modified mode [ 'deps/hiredis/net.h', 420, 438 ]
186 silly gunzTarPerm extractEntry deps/hiredis/README.md
187 silly gunzTarPerm modified mode [ 'deps/hiredis/README.md', 420, 438 ]
188 silly gunzTarPerm extractEntry deps/hiredis/sds.c
189 silly gunzTarPerm modified mode [ 'deps/hiredis/sds.c', 420, 438 ]
190 silly gunzTarPerm extractEntry deps/hiredis/sds.h
191 silly gunzTarPerm modified mode [ 'deps/hiredis/sds.h', 420, 438 ]
192 silly gunzTarPerm extractEntry deps/hiredis/test.c
193 silly gunzTarPerm modified mode [ 'deps/hiredis/test.c', 420, 438 ]
194 silly gunzTarPerm extractEntry deps/hiredis/adapters/ae.h
195 silly gunzTarPerm modified mode [ 'deps/hiredis/adapters/ae.h', 420, 438 ]
196 silly gunzTarPerm extractEntry deps/hiredis/adapters/libev.h
197 silly gunzTarPerm modified mode [ 'deps/hiredis/adapters/libev.h', 420, 438 ]
198 silly gunzTarPerm extractEntry deps/hiredis/adapters/libevent.h
199 silly gunzTarPerm modified mode [ 'deps/hiredis/adapters/libevent.h', 420, 438 ]
200 verbose write writing to d:\livro-nodejs\projeto\ntalk\node_modules\hiredis\package.json
201 info preinstall [email protected]
202 verbose readDependencies loading dependencies from d:\livro-nodejs\projeto\ntalk\node_modules\hiredis\package.json
203 silly prepareForInstallMany adding bindings@* from hiredis dependencies
204 silly prepareForInstallMany adding nan@~1.1.0 from hiredis dependencies
205 verbose readDependencies loading dependencies from d:\livro-nodejs\projeto\ntalk\node_modules\hiredis\package.json
206 silly cache add args [ 'bindings@*', null ]
207 verbose cache add spec bindings@*
208 silly cache add args [ 'nan@~1.1.0', null ]
209 verbose cache add spec nan@~1.1.0
210 silly cache add parsed spec Result {
210 silly cache add   raw: 'bindings@*',
210 silly cache add   scope: null,
210 silly cache add   name: 'bindings',
210 silly cache add   rawSpec: '*',
210 silly cache add   spec: '*',
210 silly cache add   type: 'range' }
211 silly addNamed bindings@*
212 verbose addNamed "*" is a valid semver range for bindings
213 silly addNameRange { name: 'bindings', range: '*', hasData: false }
214 silly mapToRegistry name bindings
215 silly mapToRegistry using default registry
216 silly mapToRegistry registry https://registry.npmjs.org/
217 silly mapToRegistry uri https://registry.npmjs.org/bindings
218 verbose addNameRange registry:https://registry.npmjs.org/bindings not in flight; fetching
219 silly cache add parsed spec Result {
219 silly cache add   raw: 'nan@~1.1.0',
219 silly cache add   scope: null,
219 silly cache add   name: 'nan',
219 silly cache add   rawSpec: '~1.1.0',
219 silly cache add   spec: '>=1.1.0 <1.2.0',
219 silly cache add   type: 'range' }
220 silly addNamed nan@>=1.1.0 <1.2.0
221 verbose addNamed ">=1.1.0 <1.2.0" is a valid semver range for nan
222 silly addNameRange { name: 'nan', range: '>=1.1.0 <1.2.0', hasData: false }
223 silly mapToRegistry name nan
224 silly mapToRegistry using default registry
225 silly mapToRegistry registry https://registry.npmjs.org/
226 silly mapToRegistry uri https://registry.npmjs.org/nan
227 verbose addNameRange registry:https://registry.npmjs.org/nan not in flight; fetching
228 verbose request uri https://registry.npmjs.org/bindings
229 verbose request no auth needed
230 info attempt registry request try #1 at 16:20:02
231 verbose etag "1LLBF9OH58DLBEL4629U6032D"
232 http request GET https://registry.npmjs.org/bindings
233 verbose request uri https://registry.npmjs.org/nan
234 verbose request no auth needed
235 info attempt registry request try #1 at 16:20:02
236 verbose etag "9GNMF0K57Y4H80QS1L4U9QND9"
237 http request GET https://registry.npmjs.org/nan
238 http 304 https://registry.npmjs.org/nan
239 verbose headers { date: 'Tue, 15 Mar 2016 19:20:02 GMT',
239 verbose headers   via: '1.1 varnish',
239 verbose headers   'cache-control': 'max-age=300',
239 verbose headers   etag: '"9GNMF0K57Y4H80QS1L4U9QND9"',
239 verbose headers   age: '195',
239 verbose headers   connection: 'keep-alive',
239 verbose headers   'x-served-by': 'cache-iad2141-IAD',
239 verbose headers   'x-cache': 'HIT',
239 verbose headers   'x-cache-hits': '11',
239 verbose headers   'x-timer': 'S1458069602.752254,VS0,VE0',
239 verbose headers   vary: 'Accept' }
240 silly get cb [ 304,
240 silly get   { date: 'Tue, 15 Mar 2016 19:20:02 GMT',
240 silly get     via: '1.1 varnish',
240 silly get     'cache-control': 'max-age=300',
240 silly get     etag: '"9GNMF0K57Y4H80QS1L4U9QND9"',
240 silly get     age: '195',
240 silly get     connection: 'keep-alive',
240 silly get     'x-served-by': 'cache-iad2141-IAD',
240 silly get     'x-cache': 'HIT',
240 silly get     'x-cache-hits': '11',
240 silly get     'x-timer': 'S1458069602.752254,VS0,VE0',
240 silly get     vary: 'Accept' } ]
241 verbose etag https://registry.npmjs.org/nan from cache
242 verbose get saving nan to C:\Users\ti-02\AppData\Roaming\npm-cache\registry.npmjs.org\nan\.cache.json
243 verbose correctMkdir C:\Users\ti-02\AppData\Roaming\npm-cache correctMkdir not in flight; initializing
244 silly addNameRange number 2 { name: 'nan', range: '>=1.1.0 <1.2.0', hasData: true }
245 silly addNameRange versions [ 'nan',
245 silly addNameRange   [ '0.3.0-wip',
245 silly addNameRange     '0.3.0-wip2',
245 silly addNameRange     '0.3.0',
245 silly addNameRange     '0.3.1',
245 silly addNameRange     '0.3.2',
245 silly addNameRange     '0.4.0',
245 silly addNameRange     '0.4.1',
245 silly addNameRange     '0.4.2',
245 silly addNameRange     '0.4.3',
245 silly addNameRange     '0.4.4',
245 silly addNameRange     '0.5.0',
245 silly addNameRange     '0.5.1',
245 silly addNameRange     '0.5.2',
245 silly addNameRange     '0.6.0',
245 silly addNameRange     '0.7.0',
245 silly addNameRange     '0.7.1',
245 silly addNameRange     '0.8.0',
245 silly addNameRange     '1.0.0',
245 silly addNameRange     '1.1.0',
245 silly addNameRange     '1.1.1',
245 silly addNameRange     '1.1.2',
245 silly addNameRange     '1.2.0',
245 silly addNameRange     '1.3.0',
245 silly addNameRange     '1.4.0',
245 silly addNameRange     '1.4.1',
245 silly addNameRange     '1.5.0',
245 silly addNameRange     '1.4.2',
245 silly addNameRange     '1.4.3',
245 silly addNameRange     '1.5.1',
245 silly addNameRange     '1.5.2',
245 silly addNameRange     '1.6.0',
245 silly addNameRange     '1.5.3',
245 silly addNameRange     '1.6.1',
245 silly addNameRange     '1.6.2',
245 silly addNameRange     '1.7.0',
245 silly addNameRange     '1.8.0',
245 silly addNameRange     '1.8.1',
245 silly addNameRange     '1.8.2',
245 silly addNameRange     '1.8.3',
245 silly addNameRange     '1.8.4',
245 silly addNameRange     '1.9.0',
245 silly addNameRange     '2.0.0',
245 silly addNameRange     '2.0.1',
245 silly addNameRange     '2.0.2',
245 silly addNameRange     '2.0.3',
245 silly addNameRange     '2.0.4',
245 silly addNameRange     '2.0.5',
245 silly addNameRange     '2.0.6',
245 silly addNameRange     '2.0.7',
245 silly addNameRange     '2.0.8',
245 silly addNameRange     '2.0.9',
245 silly addNameRange     '2.1.0',
245 silly addNameRange     '2.2.0' ] ]
246 silly addNamed [email protected]
247 verbose addNamed "1.1.2" is a plain semver version for nan
248 silly cache afterAdd [email protected]
249 verbose afterAdd C:\Users\ti-02\AppData\Roaming\npm-cache\nan\1.1.2\package\package.json not in flight; writing
250 verbose correctMkdir C:\Users\ti-02\AppData\Roaming\npm-cache correctMkdir not in flight; initializing
251 verbose afterAdd C:\Users\ti-02\AppData\Roaming\npm-cache\nan\1.1.2\package\package.json written
252 http 304 https://registry.npmjs.org/bindings
253 verbose headers { date: 'Tue, 15 Mar 2016 19:20:02 GMT',
253 verbose headers   via: '1.1 varnish',
253 verbose headers   'cache-control': 'max-age=300',
253 verbose headers   etag: '"1LLBF9OH58DLBEL4629U6032D"',
253 verbose headers   age: '204',
253 verbose headers   connection: 'keep-alive',
253 verbose headers   'x-served-by': 'cache-iad2150-IAD',
253 verbose headers   'x-cache': 'HIT',
253 verbose headers   'x-cache-hits': '3',
253 verbose headers   'x-timer': 'S1458069602.904906,VS0,VE0',
253 verbose headers   vary: 'Accept' }
254 silly get cb [ 304,
254 silly get   { date: 'Tue, 15 Mar 2016 19:20:02 GMT',
254 silly get     via: '1.1 varnish',
254 silly get     'cache-control': 'max-age=300',
254 silly get     etag: '"1LLBF9OH58DLBEL4629U6032D"',
254 silly get     age: '204',
254 silly get     connection: 'keep-alive',
254 silly get     'x-served-by': 'cache-iad2150-IAD',
254 silly get     'x-cache': 'HIT',
254 silly get     'x-cache-hits': '3',
254 silly get     'x-timer': 'S1458069602.904906,VS0,VE0',
254 silly get     vary: 'Accept' } ]
255 verbose etag https://registry.npmjs.org/bindings from cache
256 verbose get saving bindings to C:\Users\ti-02\AppData\Roaming\npm-cache\registry.npmjs.org\bindings\.cache.json
257 verbose correctMkdir C:\Users\ti-02\AppData\Roaming\npm-cache correctMkdir not in flight; initializing
258 silly addNameRange number 2 { name: 'bindings', range: '*', hasData: true }
259 silly addNameRange versions [ 'bindings',
259 silly addNameRange   [ '0.0.1',
259 silly addNameRange     '0.1.0',
259 silly addNameRange     '0.1.1',
259 silly addNameRange     '0.2.0',
259 silly addNameRange     '0.2.1',
259 silly addNameRange     '0.2.2',
259 silly addNameRange     '0.2.3',
259 silly addNameRange     '0.2.4',
259 silly addNameRange     '0.3.0',
259 silly addNameRange     '0.4.0',
259 silly addNameRange     '1.0.0',
259 silly addNameRange     '1.1.0',
259 silly addNameRange     '1.1.1',
259 silly addNameRange     '1.2.0',
259 silly addNameRange     '1.2.1' ] ]
260 silly addNamed [email protected]
261 verbose addNamed "1.2.1" is a plain semver version for bindings
262 silly cache afterAdd [email protected]
263 verbose afterAdd C:\Users\ti-02\AppData\Roaming\npm-cache\bindings\1.2.1\package\package.json not in flight; writing
264 verbose correctMkdir C:\Users\ti-02\AppData\Roaming\npm-cache correctMkdir not in flight; initializing
265 verbose afterAdd C:\Users\ti-02\AppData\Roaming\npm-cache\bindings\1.2.1\package\package.json written
266 silly install resolved [ { name: 'nan',
266 silly install resolved     version: '1.1.2',
266 silly install resolved     description: 'Native Abstractions for Node.js: C++ header for Node 0.8->0.12 compatibility',
266 silly install resolved     main: 'include_dirs.js',
266 silly install resolved     repository: { type: 'git', url: 'git://github.com/rvagg/nan.git' },
266 silly install resolved     contributors: [ [Object], [Object], [Object], [Object], [Object], [Object] ],
266 silly install resolved     license: 'MIT',
266 silly install resolved     bugs: { url: 'https://github.com/rvagg/nan/issues' },
266 silly install resolved     homepage: 'https://github.com/rvagg/nan',
266 silly install resolved     _id: '[email protected]',
266 silly install resolved     dist:
266 silly install resolved      { shasum: 'bbd48552fc0758673ebe8fada360b60278a6636b',
266 silly install resolved        tarball: 'http://registry.npmjs.org/nan/-/nan-1.1.2.tgz' },
266 silly install resolved     _from: 'nan@>=1.1.0 <1.2.0',
266 silly install resolved     _npmVersion: '1.4.3',
266 silly install resolved     _npmUser: { name: 'rvagg', email: '[email protected]' },
266 silly install resolved     maintainers: [ [Object] ],
266 silly install resolved     directories: {},
266 silly install resolved     _shasum: 'bbd48552fc0758673ebe8fada360b60278a6636b',
266 silly install resolved     _resolved: 'https://registry.npmjs.org/nan/-/nan-1.1.2.tgz',
266 silly install resolved     readme: 'ERROR: No README data found!' },
266 silly install resolved   { name: 'bindings',
266 silly install resolved     description: 'Helper module for loading your native module\'s .node file',
266 silly install resolved     keywords: [ 'native', 'addon', 'bindings', 'gyp', 'waf', 'c', 'c++' ],
266 silly install resolved     version: '1.2.1',
266 silly install resolved     author:
266 silly install resolved      { name: 'Nathan Rajlich',
266 silly install resolved        email: '[email protected]',
266 silly install resolved        url: 'http://tootallnate.net' },
266 silly install resolved     repository:
266 silly install resolved      { type: 'git',
266 silly install resolved        url: 'git://github.com/TooTallNate/node-bindings.git' },
266 silly install resolved     main: './bindings.js',
266 silly install resolved     bugs: { url: 'https://github.com/TooTallNate/node-bindings/issues' },
266 silly install resolved     homepage: 'https://github.com/TooTallNate/node-bindings',
266 silly install resolved     license: 'MIT',
266 silly install resolved     gitHead: 'e404152ee27f8478ccbc7122ee051246e8e5ec02',
266 silly install resolved     _id: '[email protected]',
266 silly install resolved     scripts: {},
266 silly install resolved     _shasum: '14ad6113812d2d37d72e67b4cacb4bb726505f11',
266 silly install resolved     _from: 'bindings@*',
266 silly install resolved     _npmVersion: '1.4.14',
266 silly install resolved     _npmUser: { name: 'tootallnate', email: '[email protected]' },
266 silly install resolved     maintainers: [ [Object], [Object] ],
266 silly install resolved     dist:
266 silly install resolved      { shasum: '14ad6113812d2d37d72e67b4cacb4bb726505f11',
266 silly install resolved        tarball: 'http://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz' },
266 silly install resolved     directories: {},
266 silly install resolved     _resolved: 'https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz',
266 silly install resolved     readme: 'ERROR: No README data found!' } ]
267 info install [email protected] into d:\livro-nodejs\projeto\ntalk\node_modules\hiredis
268 info install [email protected] into d:\livro-nodejs\projeto\ntalk\node_modules\hiredis
269 info installOne [email protected]
270 verbose installOne of nan to d:\livro-nodejs\projeto\ntalk\node_modules\hiredis not in flight; installing
271 verbose correctMkdir C:\Users\ti-02\AppData\Roaming\npm-cache\_locks correctMkdir not in flight; initializing
272 info installOne [email protected]
273 verbose installOne of bindings to d:\livro-nodejs\projeto\ntalk\node_modules\hiredis not in flight; installing
274 verbose correctMkdir C:\Users\ti-02\AppData\Roaming\npm-cache\_locks correctMkdir not in flight; initializing
275 verbose lock using C:\Users\ti-02\AppData\Roaming\npm-cache\_locks\bindings-29c02020caa3742a.lock for d:\livro-nodejs\projeto\ntalk\node_modules\hiredis\node_modules\bindings
276 verbose lock using C:\Users\ti-02\AppData\Roaming\npm-cache\_locks\nan-78673def17bae107.lock for d:\livro-nodejs\projeto\ntalk\node_modules\hiredis\node_modules\nan
277 silly install write writing bindings 1.2.1 to d:\livro-nodejs\projeto\ntalk\node_modules\hiredis\node_modules\bindings
278 silly install write writing nan 1.1.2 to d:\livro-nodejs\projeto\ntalk\node_modules\hiredis\node_modules\nan
279 verbose unbuild node_modules\hiredis\node_modules\nan
280 silly gentlyRm d:\livro-nodejs\projeto\ntalk\node_modules\hiredis\node_modules\nan is being purged from base d:\livro-nodejs\projeto\ntalk
281 verbose gentlyRm don't care about contents; nuking d:\livro-nodejs\projeto\ntalk\node_modules\hiredis\node_modules\nan
282 verbose tar unpack C:\Users\ti-02\AppData\Roaming\npm-cache\nan\1.1.2\package.tgz
283 verbose tar unpacking to d:\livro-nodejs\projeto\ntalk\node_modules\hiredis\node_modules\nan
284 silly gentlyRm d:\livro-nodejs\projeto\ntalk\node_modules\hiredis\node_modules\nan is being purged
285 verbose gentlyRm don't care about contents; nuking d:\livro-nodejs\projeto\ntalk\node_modules\hiredis\node_modules\nan
286 silly gunzTarPerm modes [ '777', '666' ]
287 silly gunzTarPerm extractEntry package.json
288 silly gunzTarPerm modified mode [ 'package.json', 420, 438 ]
289 silly gunzTarPerm extractEntry README.md
290 silly gunzTarPerm modified mode [ 'README.md', 420, 438 ]
291 silly gunzTarPerm extractEntry LICENSE
292 silly gunzTarPerm modified mode [ 'LICENSE', 420, 438 ]
293 silly gunzTarPerm extractEntry include_dirs.js
294 silly gunzTarPerm modified mode [ 'include_dirs.js', 420, 438 ]
295 silly gunzTarPerm extractEntry .dntrc
296 silly gunzTarPerm modified mode [ '.dntrc', 420, 438 ]
297 silly gunzTarPerm extractEntry build/config.gypi
298 silly gunzTarPerm modified mode [ 'build/config.gypi', 420, 438 ]
299 silly gunzTarPerm extractEntry nan.h
300 silly gunzTarPerm modified mode [ 'nan.h', 420, 438 ]
301 verbose unbuild node_modules\hiredis\node_modules\bindings
302 silly gentlyRm d:\livro-nodejs\projeto\ntalk\node_modules\hiredis\node_modules\bindings is being purged from base d:\livro-nodejs\projeto\ntalk
303 verbose gentlyRm don't care about contents; nuking d:\livro-nodejs\projeto\ntalk\node_modules\hiredis\node_modules\bindings
304 verbose tar unpack C:\Users\ti-02\AppData\Roaming\npm-cache\bindings\1.2.1\package.tgz
305 verbose tar unpacking to d:\livro-nodejs\projeto\ntalk\node_modules\hiredis\node_modules\bindings
306 silly gentlyRm d:\livro-nodejs\projeto\ntalk\node_modules\hiredis\node_modules\bindings is being purged
307 verbose gentlyRm don't care about contents; nuking d:\livro-nodejs\projeto\ntalk\node_modules\hiredis\node_modules\bindings
308 silly gunzTarPerm modes [ '777', '666' ]
309 silly gunzTarPerm extractEntry package.json
310 silly gunzTarPerm modified mode [ 'package.json', 420, 438 ]
311 silly gunzTarPerm extractEntry README.md
312 silly gunzTarPerm modified mode [ 'README.md', 420, 438 ]
313 silly gunzTarPerm extractEntry bindings.js
314 silly gunzTarPerm modified mode [ 'bindings.js', 420, 438 ]
315 verbose write writing to d:\livro-nodejs\projeto\ntalk\node_modules\hiredis\node_modules\bindings\package.json
316 verbose write writing to d:\livro-nodejs\projeto\ntalk\node_modules\hiredis\node_modules\nan\package.json
317 info preinstall [email protected]
318 verbose readDependencies loading dependencies from d:\livro-nodejs\projeto\ntalk\node_modules\hiredis\node_modules\bindings\package.json
319 verbose readDependencies loading dependencies from d:\livro-nodejs\projeto\ntalk\node_modules\hiredis\node_modules\bindings\package.json
320 silly install resolved []
321 verbose about to build d:\livro-nodejs\projeto\ntalk\node_modules\hiredis\node_modules\bindings
322 info build d:\livro-nodejs\projeto\ntalk\node_modules\hiredis\node_modules\bindings
323 info linkStuff [email protected]
324 silly linkStuff [email protected] has d:\livro-nodejs\projeto\ntalk\node_modules\hiredis\node_modules as its parent node_modules
325 info preinstall [email protected]
326 verbose readDependencies loading dependencies from d:\livro-nodejs\projeto\ntalk\node_modules\hiredis\node_modules\nan\package.json
327 verbose linkBins [email protected]
328 verbose linkMans [email protected]
329 verbose rebuildBundles [email protected]
330 info install [email protected]
331 info postinstall [email protected]
332 verbose readDependencies loading dependencies from d:\livro-nodejs\projeto\ntalk\node_modules\hiredis\node_modules\nan\package.json
333 verbose unlock done using C:\Users\ti-02\AppData\Roaming\npm-cache\_locks\bindings-29c02020caa3742a.lock for d:\livro-nodejs\projeto\ntalk\node_modules\hiredis\node_modules\bindings
334 silly install resolved []
335 verbose about to build d:\livro-nodejs\projeto\ntalk\node_modules\hiredis\node_modules\nan
336 info build d:\livro-nodejs\projeto\ntalk\node_modules\hiredis\node_modules\nan
337 info linkStuff [email protected]
338 silly linkStuff [email protected] has d:\livro-nodejs\projeto\ntalk\node_modules\hiredis\node_modules as its parent node_modules
339 verbose linkBins [email protected]
340 verbose linkMans [email protected]
341 verbose rebuildBundles [email protected]
342 info install [email protected]
343 info postinstall [email protected]
344 verbose unlock done using C:\Users\ti-02\AppData\Roaming\npm-cache\_locks\nan-78673def17bae107.lock for d:\livro-nodejs\projeto\ntalk\node_modules\hiredis\node_modules\nan
345 verbose about to build d:\livro-nodejs\projeto\ntalk\node_modules\hiredis
346 info build d:\livro-nodejs\projeto\ntalk\node_modules\hiredis
347 info linkStuff [email protected]
348 silly linkStuff [email protected] has d:\livro-nodejs\projeto\ntalk\node_modules as its parent node_modules
349 verbose linkBins [email protected]
350 verbose linkMans [email protected]
351 verbose rebuildBundles [email protected]
352 verbose rebuildBundles [ 'bindings', 'nan' ]
353 info install [email protected]
354 verbose unsafe-perm in lifecycle true
355 info [email protected] Failed to exec install script
356 verbose unlock done using C:\Users\ti-02\AppData\Roaming\npm-cache\_locks\hiredis-9e61669142282db0.lock for d:\livro-nodejs\projeto\ntalk\node_modules\hiredis
357 verbose stack Error: [email protected] install: `node-gyp rebuild`
357 verbose stack Exit status 1
357 verbose stack     at EventEmitter.<anonymous> (c:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:214:16)
357 verbose stack     at emitTwo (events.js:87:13)
357 verbose stack     at EventEmitter.emit (events.js:172:7)
357 verbose stack     at ChildProcess.<anonymous> (c:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
357 verbose stack     at emitTwo (events.js:87:13)
357 verbose stack     at ChildProcess.emit (events.js:172:7)
357 verbose stack     at maybeClose (internal/child_process.js:827:16)
357 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
358 verbose pkgid [email protected]
359 verbose cwd d:\livro-nodejs\projeto\ntalk
360 error Windows_NT 6.3.9600
361 error argv "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
362 error node v4.4.0
363 error npm  v2.14.20
364 error code ELIFECYCLE
365 error [email protected] install: `node-gyp rebuild`
365 error Exit status 1
366 error Failed at the [email protected] install script 'node-gyp rebuild'.
366 error This is most likely a problem with the hiredis package,
366 error not with npm itself.
366 error Tell the author that this fails on your system:
366 error     node-gyp rebuild
366 error You can get information on how to open an issue for this project with:
366 error     npm bugs hiredis
366 error Or if that isn't available, you can get their info via:
366 error
366 error     npm owner ls hiredis
366 error There is likely additional logging output above.
367 verbose exit [ 1, true ]
368 verbose unbuild node_modules\hiredis
369 info preuninstall [email protected]
370 info uninstall [email protected]
371 verbose unbuild rmStuff [email protected] from d:\livro-nodejs\projeto\ntalk\node_modules
372 info postuninstall [email protected]
373 silly gentlyRm d:\livro-nodejs\projeto\ntalk\node_modules\hiredis is being purged from base d:\livro-nodejs\projeto\ntalk
374 verbose gentlyRm don't care about contents; nuking d:\livro-nodejs\projeto\ntalk\node_modules\hiredis
375 silly vacuum-fs purging d:\livro-nodejs\projeto\ntalk\node_modules\hiredis
376 silly vacuum-fs quitting because other entries in d:\livro-nodejs\projeto\ntalk\node_modules

Estou no Windows 8.

parece q o erro ocorre devido ao esse tals de "hiredis", ele serve pra q?
pela extensão do arquivo parece ser uma solução do visual studio, talvez o processo de build do node o utilize, enfim, não sei exatamente como remover essa duplicidade no hiredis

Capítulo 6 - Require- socket

[dúvida de iniciante]
Olá caio,
acabei de terminar a sessão 6.7 do livro e tenho dúvida em relação a como chamar o script sockets/chat.js no app.js. No caso, o load('sockets').into(io) só torna o escopo global do app.js também escopo global dos scripts da pasta sockets.
É isso? só fazendo o require(sockets/chat.js) faria necessário esse código ser executado?
projeto--> https://github.com/geanfelipe/livro-nodejs
agradeço

Olá, estou com um problema no final do capitulo 4.

Oi tudo bem?
Estou tendo um problema no final do capitudo 4 onde ao rodar o app.js recebo uma mensagem no browser (Cannot GET /)

Estou a um dia com esse problema e não consigo encontrar o erro.

module.exports = function(app) {

var home = app.controllers.home;

app.get('/', home.index);
app.post('/entrar', home.login);
app.get('/sair', home.logout);
};

module.exports = function(app) {
var HomeController = {
index: function(req, res) {
res.render('home/index');
},
login: function(rq, res) {
var email = req.body.usuario.email
, nome = req.body.usuario.nome;
if(email && nome) {
var usuario = req.body.usuario;
usuario['contatos'] = [];
req.session.usuario = usuario;
res.redirect('/contatos');
} else {
res.redirect('/');
}
},
logout: function(req, res) {
req.session.destroy();
res.redirect('/');
}
};
return HomeController;
};

O chat não recebe as msg, porem envia para o servidor.

Ao digitar a msg no chat ela somente é enviada e não e apresentada na tela.
coloquei o console.log() no codigo do chat.js exibido abaixo e ao testar foi impresso no terminal o conteudo exibido abixo do codigo do chat.js.

module.exports = function(io) {
  var crypto = require('crypto')
    , redis = require('redis').createClient()
    , sockets = io.sockets
  ;
  sockets.on('connection', function (client) {
    var session = client.handshake.session
      , usuario = session.usuario
    ;
    redis.sadd('onlines', usuario.email, function(erro) {
      redis.smembers('onlines', function(erro, emails) {
        emails.forEach(function(email) {
          client.emit('notify-onlines', email);
          client.broadcast.emit('notify-onlines', email);
        });
      });
    });

    client.on('join', function(sala) {
      if(!sala) {
        var timestamp = new Date().toString()
          , md5 = crypto.createHash('md5')
        ;
        sala = md5.update(timestamp).digest('hex');
      }

      session.sala = sala;
      client.join(sala);

      var msg = "<b>"+usuario.nome+":</b> entrou.<br>";

      redis.lrange(sala, 0, -1, function(erro, msgs) {
        msgs.forEach(function(msg) {
        console.log(msg);
            client.emit('send-client', msg);
        });
        redis.rpush(sala, msg);
        console.log(msg);
        sockets.in(sala).emit('send-client', msg);
      });
    });

    client.on('disconnect', function () {
      var sala = session.sala
        , msg = "<b>"+ usuario.nome +":</b> saiu.<br>";
      redis.rpush(sala, msg);
      client.broadcast.emit('notify-offlines', usuario.email);
      sockets.in(sala).emit('send-client', msg);
      redis.srem('onlines', usuario.email);
      client.leave(sala);
    }); 

    client.on('send-server', function (msg) {
      var sala = session.sala
        , data = {email: usuario.email, sala: sala};
      msg = "<b>"+usuario.nome+":</b> "+msg+"<br>";
      redis.rpush(sala, msg);
      client.broadcast.emit('new-message', data);
        console.log(msg);
      sockets.in(sala).emit('send-client', msg);
    });
  });
}

msg impressa no terminal

Ntalk no ar.
<b>Manoel :</b> entrou.<br>
<b>Andre:</b> entrou.<br>
<b>Manoel :</b> ola<br>
<b>Andre:</b> oi<br>
<b>Manoel :</b> oi<br>
<b>Andre:</b> ola<br>

ERRO, iniciando com Express

Boa tarde.

Estou acompanhando o livro, mas na pagina 45 ao tentar executar o comando node app.js, retorna o seguinte erro:

Error: Cannot find module './routes/index'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object. (D:\pessoal\estudo\nodejs\book\ntalk\app.js:2:14)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)

Pode me ajudar por favor?

Valeu

Dominando o Express 5.2 Controlando as sessões de usuários pág 47

Olá, seguindo os passos do livro travei na página 47, segue o erro:

erro-pag-47

tentei

npm install cookie-parser
..
dp inseri no app.js

var express = require('express'),
load = require('express-load'),
cookieParser = require('cookie-parser'),
app = express();

mas continua o erro. Alguma solução?
Grato.

Instalação módulo mongoose

Caio,

Juro que tentei resolver os problemas pelas vias normais (google) antes de vir aqui abrir uma Issue, mas tô penando tem uns dias. Acontece que desde que cheguei no capítulo da integração com banco não consegui seguir adiante. Tentando tantas alternativas instalei o módulo node-gyp global, e agora sempre que tento instalar tanto o socket.io quanto mongoose é gerada essa saída de erro:

[email protected] install /home/pedro/projects/ntalk/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos
(node-gyp rebuild 2> builderror.log) || (exit 0)

make: Entering directory /home/pedro/projects/ntalk/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build' CXX(target) Release/obj.target/kerberos/lib/kerberos.o make: Leaving directory/home/pedro/projects/ntalk/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build'
npm WARN installMany nopt was bundled with [email protected], but bundled package wasn't found in unpacked tree
npm WARN installMany npmlog was bundled with [email protected], but bundled package wasn't found in unpacked tree
npm WARN installMany request was bundled with [email protected], but bundled package wasn't found in unpacked tree
npm WARN installMany semver was bundled with [email protected], but bundled package wasn't found in unpacked tree
npm WARN installMany tar was bundled with [email protected], but bundled package wasn't found in unpacked tree
npm WARN installMany tar-pack was bundled with [email protected], but bundled package wasn't found in unpacked tree
npm WARN installMany mkdirp was bundled with [email protected], but bundled package wasn't found in unpacked tree
npm WARN installMany rc was bundled with [email protected], but bundled package wasn't found in unpacked tree
npm WARN installMany rimraf was bundled with [email protected], but bundled package wasn't found in unpacked tree
|

[email protected] install /home/pedro/projects/ntalk/node_modules/mongoose/node_modules/bson/node_modules/bson-ext
(node-pre-gyp install --fallback-to-build) || (node-gyp rebuild 2> builderror.log) || (exit 0)

make: Entering directory /home/pedro/projects/ntalk/node_modules/mongoose/node_modules/bson/node_modules/bson-ext/build' CXX(target) Release/obj.target/bson/ext/bson.o SOLINK_MODULE(target) Release/obj.target/bson.node SOLINK_MODULE(target) Release/obj.target/bson.node: Finished COPY Release/bson.node make: Leaving directory/home/pedro/projects/ntalk/node_modules/mongoose/node_modules/bson/node_modules/bson-ext/build'
[email protected] node_modules/ejs

[email protected] node_modules/cookie-parser
├── [email protected]
└── [email protected]

[email protected] node_modules/express-load
└── [email protected]

[email protected] node_modules/method-override
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected] ([email protected])

[email protected] node_modules/express-session
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
└── [email protected] ([email protected])

[email protected] node_modules/express
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected])
└── [email protected] ([email protected], [email protected])

[email protected] node_modules/body-parser
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected]
└── [email protected] ([email protected], [email protected])

[email protected] node_modules/mongoose
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected])
└── [email protected] ([email protected])

Clusters caindo fora

Os clusters estão entrando e saindo, ate que o servidor todo apenas aborta e é finalizado.

2 Capitulo,. Código: hello_server3.js

O Código por algum motivo apresenta o seguinte erro no terminal:

nodejs hello_server3.js

events.js:72
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE
at errnoException (net.js:901:11)
at Server._listen2 (net.js:1039:14)
at listen (net.js:1061:10)
at Server.listen (net.js:1135:5)
at Object. (/media/alexandre/1TB/Estudar/Programação/node.js/Codigos/Cap2/hello_server3.js:18:8)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)

Eu não entendi o por que do erro, já que o código que eu usei e o mesmo do livro e o mesmo do github.

Erro cap 5 - Não estou conseguindo listar os usuário apos logar

Não sei o que pode ser, mas segue meu repositorio para dar uma olhada:
https://github.com/EderRoger/node_study

como estou lendo o livro agora, precisei mudar algumas coisas principalmente no app, na questão de carregamentos de bibliotecas.

No controller home.js precisei adicionar esta linha usuario['contatos'] = []; // CRIA UM ARRAY DE CONTATOS VAZIO , para não dar erro na listagem dos usuarios...

Agradeço,

E otimo livro, muito bom!

Sessão 6.3 do livro (Mensagens não aparecem na tela)

Prezado Caio, não sei se este é o melhor lugar para reportar dúvidas. De todo modo, peço desculpas caso não seja.
Estou acompanhando o livro de Node.JS (versão mais atual). Ao executar o código do chat referente à sessão 6.3 a mensagem enviada não é mostrada na tela. Talvez eu esteja esquecendo de algo no código, mas revisei esta sessão várias vezes. Alguma ideia do que pode ser?

capitulo 5.2

Aqui seguindo o exemplo, só consegui passar do capitulo 5.2 depois que criei o arquivo Usuario.js em models.

Alternativas para o módulo Hi-Redis

Olá. Como estou desenvolvendo o Ntalk em um computador windows, encontrei certos problemas ao chegar no capitulo 7. O Redis, que não é suportado oficialmente no windows, foi instalado de boa graças a isso: https://github.com/MSOpenTech/redis

Porém não consigo instalar o Hi-Redis, dando o famoso problema do "node-gyp rebuild". Apesar de ter visto várias soluções para o problema, nenhuma funcionou e depois de um dia e meio travado por causa disso eu decidi desistir do Hi-Redis.

Não existe nenhuma alternativa para esse modulo? Ou a possibilidade de não utiliza-lo no projeto do Ntalk?

Caso o problema com a instalação do Hi-Redis não tenha sido clara, deixo em anexo o relatório do erro.

npm-debug.txt

Error

Olá Caio, blz.
Refiz mais de 3x o capitulo 4 e só tenho retorno de um erro no navegador, abaixo o erro:

  Error: No default engine was specified and no extension was provided. 
at new View (c:\wamp\www\ntalk\node_modules\express\lib\view.js:41:42)
at Function.app.render (c:\wamp\www\ntalk\node_modules\express\lib\application.js:486:12)
at ServerResponse.res.render (c:\wamp\www\ntalk\node_modules\express\lib\response.js:798:7)
at HomeController.index (c:\wamp\www\ntalk\controllers\home.js:4:8)
at callbacks (c:\wamp\www\ntalk\node_modules\express\lib\router\index.js:164:37)
at param (c:\wamp\www\ntalk\node_modules\express\lib\router\index.js:138:11)
at pass (c:\wamp\www\ntalk\node_modules\express\lib\router\index.js:145:5)
at Router._dispatch (c:\wamp\www\ntalk\node_modules\express\lib\router\index.js:173:5)
at Object.router (c:\wamp\www\ntalk\node_modules\express\lib\router\index.js:33:10)
at next (c:\wamp\www\ntalk\node_modules\express\node_modules\connect\lib\proto.js:193:15)

Não consigo fazer nossa aplicação de exemplo. Será que tem haver com a instalação global no express.

Meu sistema operacional é windows 8.1 64bits

Mudança de URL de Download do Node no capítulo 3

Olá Caio, tudo bom?

Primeiramente, parabéns pelo livro, comecei a trabalhar com Node e o livro tem sido de grande ajuda.

Problema

No capítulo 3 onde é feito benchmark sobre o funcionamento síncrono x assíncrono, o arquivo processamento.js possui uma url para download do executável do node, porém esta url esta quebrada -> https://nodejs.org/dist/latest/node.exe

Solução

Substituir a url para alguma das urls das releases atuais, como https://nodejs.org/dist/v8.3.0/node-v8.3.0-win-x64.zip

Bugs Capitulo 5

Boa noite, encontrei 2 Bugs ao finalizar o capitulo 5, mas felizmente também achei a solução:

=====ERRO=====

index.ejs:20 18| 19| >> 20| <% contatos.forEach(function(contato, index) { %> 21| 22| <%- contato.nome %> 23| <%- contato.email %> contatos is not defined

arquivo: controllers/contatos.js

=====ORIGINAL=====
index: function(req, res) {
var usuario = req.session.usuario
,contatos = [usuario.contatos] <-- quando criado a variavel contatos e params assim a view não estava reconhecendo, e como usuario.contatos já era um objeto criado no home.js, acabava ficando [[objeto]];
,params = {usuario: usuario};
res.render('contatos/index', params);
},

=====EDITADO=====
index: function(req, res) {
var usuario = req.session.usuario;
contatos = usuario.contatos; <-- desse jeito funcionou
params = {usuario: usuario};
res.render('contatos/index', params);
},

Dúvida sobre o chat

Boa noite!
Estou lendo seu livro e ele é muito bom.
Estou seguindo os exemplos e estou implementando o ntalk, estou no capítulo 6.6.
Fiz um teste com o chat abrindo dois navegadores e logando no ntalk, cada navegador com um usuário diferente e em cada navegador criando e escolhendo contatos diferentes para conversar, só que no chat o usuário que realiza a conversa não é o usuário logado no sistema, mas sim o contato. É assim mesmo?
E a conversa vai para todos os navegadores e não privada para o contato, é isso mesmo?

Desde já grato pela atenção.

Join na Sala

Ola, notei que no livro você não faz menção do:

socket.emit('join',sala);

no lado cliente (a versão que tenho do livro não sei se é a mais atual, mas foi a do ano passado), vi que você já corrigiu esse erro em seu repositório esse ano, mas essa alteração será refletida no livro?
outra pergunta é: por que somente quando o usuário manda a primeira mensagem no bate papo que é atualizado o link para ele entrar na sala, ao invés atualizar quando ele clicasse em conversar? segundo o trecho de código a seguir retirado do seu repositório:

arquivo: chat/index.ejs

var enviar = function() {
    var msg = document.getElementById('mensagem');
    socket.emit('send-server', msg.value);
    msg.value = '';
  };

arquivo: sockets/chat.js

client.on('send-server', function (msg) {
      var sala = session.sala
        , data = {email: usuario.email, sala: sala};
      msg = "<b>"+usuario.nome+":</b> "+msg+"<br>";
      redis.lpush(sala, msg);
      client.broadcast.emit('new-message', data);
      sockets.in(sala).emit('send-client', msg);
    });

arquivo: contatos/notify_script.ejs

socket.on('new-message', function(data) {
    var opts = {el: 'notify_' + data.email
              , msg: 'Mensagem'
              , classes: 'label label-important'};
    notify(opts);
    var chat = document.getElementById('chat_' + data.email);
    chat.href += '?sala=' + data.sala;
  });

Desde já agradeço pela atenção 👍

Erro na ligação home router x home controller

Ao instanciar a aplicação, estou tendo o seguinte erro:
c:\Cursos\nodejs\ntalk\node_modules\express\lib\router\index.js:140
var search = 1 + req.url.indexOf('?');
^
TypeError: Cannot read property 'indexOf' of undefined
at Function.handle (c:\Cursos\nodejs\ntalk\node_modules\express\lib\router\index.js:140:27)
at Object.router (c:\Cursos\nodejs\ntalk\node_modules\express\lib\router\index.js:46:12)
at c:\Cursos\nodejs\ntalk\node_modules\express-load\lib\express-load.js:242:19

segue o home router:

module.exports = function(app){
var homeCtrl = app.controllers.home;
console.log(">>>No router home<<<");
app.get('/', homeCtrl.index);
};

segue o home controller:

module.exports = function(app){
var homeController = {
index : function(req, res ){
console.log(">>>No controller home<<<");
res.render('home/index');
}
};
return homeController;
}

segue o app.js:

var express = require('express')
, load = require('express-load');
var app = express();
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
app.use(express.static(__dirname + '/public'));
load('models').then('controllers').then('routes').into(app);
app.listen(3000, function(){
console.log("Ntalk no ar!");
});
module.exports = app;

É como se no start da aplicação, o "app.get('/', homeCtrl.index);" estive fazendo uma chamada ao index do controller e não passando o request.

Caio, pode me ajudar ?

Erro a rodar projeto do capitulo quatro

De acordo com o que ví nos erros anteriores o que está acontecendo comigo é diferente. Segue:

> [email protected] start /home/pmargreff/Dropbox/classes/node/livro-nodejs/projeto/ntalk
> node server

Ntalk no ar.

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED
    at RedisClient.on_error (/home/pmargreff/Dropbox/classes/node/livro-nodejs/projeto/ntalk/node_modules/socket.io-redis/node_modules/redis/index.js:185:24)
    at Socket.<anonymous> (/home/pmargreff/Dropbox/classes/node/livro-nodejs/projeto/ntalk/node_modules/socket.io-redis/node_modules/redis/index.js:95:14)
    at Socket.EventEmitter.emit (events.js:95:17)
    at net.js:441:14
    at process._tickCallback (node.js:415:13)
Ntalk no ar.

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED
    at RedisClient.on_error (/home/pmargreff/Dropbox/classes/node/livro-nodejs/projeto/ntalk/node_modules/socket.io-redis/node_modules/redis/index.js:185:24)
    at Socket.<anonymous> (/home/pmargreff/Dropbox/classes/node/livro-nodejs/projeto/ntalk/node_modules/socket.io-redis/node_modules/redis/index.js:95:14)
    at Socket.EventEmitter.emit (events.js:95:17)
    at net.js:441:14
    at process._tickCallback (node.js:415:13)
Ntalk no ar.

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: failed to connect to [undefined:27017]
    at null.<anonymous> (/home/pmargreff/Dropbox/classes/node/livro-nodejs/projeto/ntalk/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:556:74)
    at EventEmitter.emit (events.js:106:17)
    at null.<anonymous> (/home/pmargreff/Dropbox/classes/node/livro-nodejs/projeto/ntalk/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:156:15)
    at EventEmitter.emit (events.js:98:17)
    at Socket.<anonymous> (/home/pmargreff/Dropbox/classes/node/livro-nodejs/projeto/ntalk/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection.js:534:10)
    at Socket.EventEmitter.emit (events.js:95:17)
    at net.js:830:16
    at process._tickCallback (node.js:415:13)
Ntalk no ar.

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: failed to connect to [undefined:27017]
    at null.<anonymous> (/home/pmargreff/Dropbox/classes/node/livro-nodejs/projeto/ntalk/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:556:74)
    at EventEmitter.emit (events.js:106:17)
    at null.<anonymous> (/home/pmargreff/Dropbox/classes/node/livro-nodejs/projeto/ntalk/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:156:15)
    at EventEmitter.emit (events.js:98:17)
    at Socket.<anonymous> (/home/pmargreff/Dropbox/classes/node/livro-nodejs/projeto/ntalk/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection.js:534:10)
    at Socket.EventEmitter.emit (events.js:95:17)
    at net.js:830:16
    at process._tickCallback (node.js:415:13)
Ntalk no ar.

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED
    at RedisClient.on_error (/home/pmargreff/Dropbox/classes/node/livro-nodejs/projeto/ntalk/node_modules/socket.io-redis/node_modules/redis/index.js:185:24)
    at Socket.<anonymous> (/home/pmargreff/Dropbox/classes/node/livro-nodejs/projeto/ntalk/node_modules/socket.io-redis/node_modules/redis/index.js:95:14)
    at Socket.EventEmitter.emit (events.js:95:17)
    at net.js:441:14
    at process._tickCallback (node.js:415:13)
Ntalk no ar.

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED
    at RedisClient.on_error (/home/pmargreff/Dropbox/classes/node/livro-nodejs/projeto/ntalk/node_modules/socket.io-redis/node_modules/redis/index.js:185:24)
    at Socket.<anonymous> (/home/pmargreff/Dropbox/classes/node/livro-nodejs/projeto/ntalk/node_modules/socket.io-redis/node_modules/redis/index.js:95:14)
    at Socket.EventEmitter.emit (events.js:95:17)
    at net.js:441:14
    at process._tickCallback (node.js:415:13)
Ntalk no ar.


Alguém pode me ajudar com isso?

session.io + clusters

Fazendo alguns testes na aplicação após utilizar clusters e redis pra controlar as sessões, percebi que as mensagens do chat não estavam sendo enviadas de um usuário para outro. Verifiquei no dev tools as requisições e lá estavam sendo exibidas várias delas falhando, com status 400 (fora que o uso de websocket não estava mais funcionando), após clicar no botão enviar:

400

Todas as requisições continham a mensagem: Session ID unknown.

Depois de tentar debugar o código, verificando se tinha algo errado ou diferente dos teus exemplos, fui procurar no Google e achei essa issue no github falando do mesmo problema:

socketio/socket.io#1503 (comment)

Em um dos comentários um cara diz pra utilizar o módulo sticky-session e esse problema é resolvido.

Tentei fazer funcionar e consegui. As alterações que fiz foram poucas:

//app.js....
sticky(server).listen(3000, function () {
    console.log('NTalk no ar!');
});

e removi a última linha que continha o module.exports = app;

Funcionou normalmente. Rodando esse arquivo o sticky-session já cria os clusters, não sendo mais necessário utilizar o clusters.js.

Você já tinha notado isso, Caio? Não achei nenhuma issue sobre isso, então resolvi comentar.
Se você não tiver nenhuma ressalva, acho que seria bom comentar sobre isso na próxima atualização do livro.

Abraço,

EDIT: Outro link interessante que fala sobre isso (e também menciona o sticky-session) é do próprio
socket.io: socket.io/sticky-load-balancing

[capitulo4] - Problemas com CSS

Boa noite amigo!!!

Finalizei o capitulo 4 e consegui rodar minha aplicação, porem os estilos não pegaram, está com todos os elementos HTML mas nada de estilo como diz no livro.

Erro Cap. 5.5 pagina 59

Ola Caio!

Fiz as mudanças ate a pagina 59, e quando fui testar e tentar entrar no sistema para realizar cadastros da o erro:

Unexpected token ) in "/home/calebe/ntalk/views/contatos/index.ejs"

image

image

image

image

Fico no aguardo se puder me ajudar...

Obrigado

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.