Nodejs readline giving some error - node.js

I want to read a file line by line and based on the data in each line i have to categorise the data.
var rd = readline.createInterface({
input: fs.createReadStream('/home/user/Desktop/text.txt'),
output: process.stdout,
console: false
});
When this line is executed the file is read and printed in the terminal.
But when I try to read the file line by line using readline I am getting error.
rd.on('line', (input) => {
console.log(input);
});
I am getting the following error.
`Interface {
_sawReturnAt: 0,
isCompletionEnabled: true,
_sawKeyPress: false,
_previousKey:
{ sequence: '\n',
name: 'enter',
ctrl: false,
meta: false,
shift: false },
domain:
Domain {
domain: null,
_events: { error: [Function: debugDomainError] },
_eventsCount: 1,
_maxListeners: undefined,
members: [] },
_events: { line: [ [Function], [Function], [Function] ] },
_eventsCount: 1,
_maxListeners: undefined,
output:
WriteStream {
connecting: false,
_hadError: false,
_handle:
TTY {
bytesRead: 0,
_externalStream: {},
fd: 9,
writeQueueSize: 0,
owner: [Circular],
onread: [Function: onread] },
_parent: null,
_host: null,
_readableState:
ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: [Object],
length: 0,
pipes: null,
pipesCount: 0,
flowing: null,
ended: false,
endEmitted: false,
reading: false,
sync: true,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
defaultEncoding: 'utf8',
ranOut: false,
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null },
readable: false,
domain: null,
_events:
{ end: [Object],
finish: [Function: onSocketFinish],
_socketEnd: [Function: onSocketEnd],
resize: [Object] },
_eventsCount: 4,
_maxListeners: undefined,
_writableState:
WritableState {
objectMode: false,
highWaterMark: 16384,
needDrain: false,
ending: false,
ended: false,
finished: false,
decodeStrings: false,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 1,
prefinished: false,
errorEmitted: false,
bufferedRequestCount: 0,
corkedRequestsFree: [Object] },
writable: true,
allowHalfOpen: false,
destroyed: false,
_bytesDispatched: 22151,
_sockname: null,
_writev: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
columns: 80,
rows: 24,
_type: 'tty',
fd: 1,
_isStdio: true,
destroySoon: [Function],
destroy: [Function] },
input:
ReadStream {
_readableState:
ReadableState {
objectMode: false,
highWaterMark: 65536,
buffer: [Object],
length: 0,
pipes: null,
pipesCount: 0,
flowing: false,
ended: true,
endEmitted: true,
reading: false,
sync: false,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
defaultEncoding: 'utf8',
ranOut: false,
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null },
readable: false,
domain:
Domain {
domain: null,
_events: [Object],
_eventsCount: 1,
_maxListeners: undefined,
members: [] },
_events: { end: [Object], data: [Function: onData] },
_eventsCount: 2,
_maxListeners: undefined,
path: '/home/user/Desktop/text.txt',
fd: null,
flags: 'r',
mode: 438,
start: undefined,
end: undefined,
autoClose: true,
pos: undefined,
bytesRead: 31,
destroyed: true,
closed: true },
historySize: 30,
crlfDelay: 100,
_prompt: '> ',
terminal: true,
line: '',
cursor: 0,
history: [ '1,2,3', '4,8,4,8', '2,2,2,2', '1,2,3,4' ],
historyIndex: -1,
prevRows: 0,
paused: true,
closed: true }`
Please help I am new to this.

Your code looks fine but you are using the Node.js REPL rather than running the code from a file, which is why you're seeing this behaviour.
The Node.js REPL (what you get when you type node in terminal) will store variables. However, when only an identifier is used the value is also returned. What you're seeing isn't an error, but the rd object.
The Node.js REPL is good for testing but, unless you have a specific reason for using it, the best thing to do is create an app.js file, add your code to it and then run node app.js.
If you do need to write multi-line code using REPL, then be sure to type .editor once initialised, so that whitespace, etc. is interpreted correctly.
Also, from the 7.7.2 docs console isn't an option which createInterface is expecting, so that can be removed. In your particular example, you could also remove output: process.stdout, as your logging each line using the line event

Related

SailsJS action2 multiple file upload

I am trying to upload multiple files from sailsjs 1.2.4
Here is my action :
module.exports = {
friendlyName: 'Post',
description: 'Post something.',
files: ['mediaFiles'],
inputs: {
text : {
required: true,
type: 'string',
},
mediaFiles : {
description : "Media files",
example: '===',
required : false
}
},
exits: {
},
fn: async function (inputs) {
inputs.mediaFiles._files.forEach(file=>{
console.log(file)
})
})
}
}
I am getting below result in as file object :
{ stream:
PassThrough {
_readableState:
ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: [Object], tail: [Object], length: 2 },
length: 43093,
pipes: null,
pipesCount: 0,
flowing: null,
ended: true,
endEmitted: false,
reading: false,
sync: false,
needReadable: false,
emittedReadable: true,
readableListening: false,
resumeScheduled: false,
emitClose: true,
destroyed: false,
defaultEncoding: 'utf8',
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null },
readable: true,
domain: null,
_events:
{ prefinish: [Function: prefinish],
drain: [Function],
end: [Function],
error: [Array] },
_eventsCount: 4,
_maxListeners: undefined,
_writableState:
WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,
needDrain: false,
ending: true,
ended: true,
finished: true,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 0,
prefinished: true,
errorEmitted: false,
emitClose: true,
bufferedRequestCount: 0,
corkedRequestsFree: [Object] },
writable: false,
allowHalfOpen: true,
_transformState:
{ afterTransform: [Function: bound afterTransform],
needTransform: false,
transforming: false,
writecb: null,
writechunk: null,
writeencoding: 'buffer' },
headers:
{ 'content-disposition':
'form-data; name="mediaFiles"; filename="bwDzrPkA_400x400.jpg"',
'content-type': 'image/jpeg' },
name: 'mediaFiles',
filename: 'bwDzrPkA_400x400.jpg',
byteOffset: 378,
byteCount: 43093,
field: 'mediaFiles' },
status: 'bufferingOrWriting' }
My question is how can I write this file stream to some path like /public/media/xyz.png . I used to with sails normal file upload where I can use this.req.file("name").upload() .. but not in action 2 . I checked other answers but they are uploading to s3 not writing on same server .
You could use a dependency sails-hook-uploads, for that you are able to define the dirpath in your settings:
https://github.com/sailshq/sails-hook-uploads/blob/master/index.js#L31
module.exports.upload = {
dirpath: '.tmp/public', // recommended .tmp/uploads
adapter: require('skipper-disk'), // Default
}
I highly recommend not using the public folder because it's the compiled assets destination, so you'll probably lose these files.
As an alternative, you might use a controller to upload the file as showing below:
https://github.com/mikermcneil/ration/blob/master/api/controllers/things/upload-thing.js#L54
After that, send it to the user:
https://github.com/mikermcneil/ration/blob/master/api/controllers/things/download-photo.js#L50

AWS elasticache - Redis: Unable to debug for Redis errors

We are implementing caching using AWS Elasticache with Redis and are using nodejs for connecting it with the Redis. Creating a sorted set and adding and getting elements to and from it. It is working fine on local machine, while not working on Staging. Here is the code,
const redis = require("redis")
const redisOption = {
host: redis_host_url,
port: redis_port
}
let client = redis.createClient(redisOption);
console.log(client);
client = promisify(client.zadd).bind(client);
console.log(client);
let response = await client("abc",1,"string_to_add");
console.log(response);
Getting response printed on local machine, but Lambda logs does not contain the last console. Client is:
RedisClient {
_events: [Object: null prototype] { newListener: [Function] },
_eventsCount: 1,
_maxListeners: undefined,
address: 'XXXXXXXXXX:6379',
connection_options: { port: 6379, host: 'XXXXXXXXXX', family: 4 },
connection_id: 0,
connected: false,
ready: false,
should_buffer: false,
command_queue:
Denque {
_head: 0,
_tail: 0,
_capacityMask: 3,
_list: [ <4 empty items> ] },
offline_queue:
Denque {
_head: 0,
_tail: 0,
_capacityMask: 3,
_list: [ <4 empty items> ] },
pipeline_queue:
Denque {
_head: 0,
_tail: 0,
_capacityMask: 3,
_list: [ <4 empty items> ] },
connect_timeout: 3600000,
enable_offline_queue: true,
retry_timer: null,
retry_totaltime: 0,
retry_delay: 200,
retry_backoff: 1.7,
attempts: 1,
pub_sub_mode: 0,
subscription_set: {},
monitoring: false,
message_buffers: false,
closing: false,
server_info: {},
auth_pass: undefined,
selected_db: undefined,
fire_strings: true,
pipeline: false,
sub_commands_left: 0,
times_connected: 0,
buffers: false,
options:
{ host: XXXXXXXXXX,
port: 6379,
socket_keepalive: true,
socket_initial_delay: 0,
return_buffers: false,
detect_buffers: false },
reply: 'ON',
reply_parser:
JavascriptRedisParser {
optionReturnBuffers: false,
optionStringNumbers: false,
returnError: [Function: returnError],
returnFatalError: [Function: returnFatalError],
returnReply: [Function: returnReply],
offset: 0,
buffer: null,
bigStrSize: 0,
totalChunkSize: 0,
bufferCache: [],
arrayCache: [],
arrayPos: [] },
stream:
Socket {
connecting: true,
_hadError: false,
_handle:
TCP {
reading: false,
onread: [Function: onStreamRead],
onconnection: null,
[Symbol(owner)]: [Circular] },
_parent: null,
_host: null,
_readableState:
ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: null,
pipesCount: 0,
flowing: true,
ended: false,
endEmitted: false,
reading: false,
sync: true,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: true,
paused: false,
emitClose: false,
autoDestroy: false,
destroyed: false,
defaultEncoding: 'utf8',
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null },
readable: false,
_events:
[Object: null prototype] {
end: [Array],
connect: [Function],
data: [Function],
error: [Function],
close: [Function],
drain: [Function] },
_eventsCount: 6,
_maxListeners: undefined,
_writableState:
WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,
needDrain: false,
ending: false,
ended: false,
finished: false,
destroyed: false,
decodeStrings: false,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: true,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 0,
prefinished: false,
errorEmitted: false,
emitClose: false,
autoDestroy: false,
bufferedRequestCount: 0,
corkedRequestsFree: [Object] },
writable: true,
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null,
[Symbol(asyncId)]: 7,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0 } }
Even console after the promisify is working, and is printing:
[Function: bound zadd]
But the last console is not printing anything. I am not able to debug as, AWS Elasticache doesn't offer logs for Redis.
You need to define a bastion host in your AWS setup and locally in ~/.ssh/config
Host your-bastion-host
HostName <IP_of_your_bastion_host_on_EC2>
Port 22
User ec2-user
IdentityFile ~/.ssh/<your_key_file_for_bastion_host>.pem
ForwardAgent yes
AddKeysToAgent yes
Using a Bastion host and a VPC, you are able to connect to the AWS Elasticache service by SSH port forwarding...
ssh your-bastion-host -Cv -N -L 6390:ec-replication-group-xyz.amazonaws.com:6379
..and "redis-cli" tool (It makes sense to forward the Redis port 6379 to a different port locally if you already have a Redis server installed locally)
redis-cli -h localhost -p 6390
info
monitor
Then you can use in "redis-cli" the monitor command to display every command processed by the Redis server and the info command to get the most important information and statistics about the Redis server.

Faceted search using solr-node

I am trying to search my documents indexed on solr 6.6.5 using facet search in node.js with the solr-node module. But when I add facet=on&facet.query=: I get an HTTP 400 response from solr-node.
var client = new SolrNode({
host: 'localhost',
port: '8983',
core: 'IRF18P4',
protocol: 'http',
debugLevel: 'ERROR' // log4js debug level paramter
});
var delhiCount = client.query.q('*:*&facet.query=city:delhi&facet=on');
// Search documents using strQuery
client.search(delhiCount, function (err, result) {
if (err) {
console.log(err);
return;
}
console.log('Response:', result.response);
});
But if I try to open the same URL printed in my terminal, it works. Any idea on what could be going wrong here?
PS C:\Users\aarti\OneDrive\Documents\IR\Project4\gentelella-master\gentelella-master> node index.js
[2018-12-02 19:16:02.533] [ERROR] sole-node - Body {
url:
'http://localhost:8983/solr/IRF18P4/select?q=*%3A*%26facet%3Don%26facet.query%3Dcity%3Adelhi&wt=json',
status: 400,
statusText: 'Bad Request',
headers:
Headers {
_headers:
{ 'cache-control': [Array],
pragma: [Array],
expires: [Array],
'last-modified': [Array],
etag: [Array],
'content-type': [Array],
connection: [Array] } },
ok: false,
body:
PassThrough {
_readableState:
ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: [Object], tail: [Object], length: 1 },
length: 280,
pipes: null,
pipesCount: 0,
flowing: null,
ended: false,
endEmitted: false,
reading: true,
sync: false,
needReadable: true,
emittedReadable: true,
readableListening: false,
resumeScheduled: false,
emitClose: true,
destroyed: false,
defaultEncoding: 'utf8',
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null },
readable: true,
_events:
{ prefinish: [Function: prefinish],
unpipe: [Function: onunpipe],
drain: [Function: pipeOnDrainFunctionResult],
error: [Function: onerror],
close: [Function],
finish: [Function] },
_eventsCount: 6,
_maxListeners: undefined,
_writableState:
WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,
needDrain: false,
ending: false,
ended: false,
finished: false,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 0,
prefinished: false,
errorEmitted: false,
emitClose: true,
bufferedRequestCount: 0,
corkedRequestsFree: [Object] },
writable: true,
allowHalfOpen: true,
_transformState:
{ afterTransform: [Function: bound afterTransform],
needTransform: true,
transforming: false,
writecb: null,
writechunk: null,
writeencoding: 'buffer' } },
bodyUsed: false,
size: 0,
timeout: 0,
_raw: [],
_abort: false }
Solr server error: 400
Your URL being printed in Output is Wrong.
http://localhost:8983/solr/IRF18P4/select?q=*%3A*%26facet%3Don%26facet.query%3Dcity%3Adelhi&wt=json
Above should look like,
http://localhost:8983/solr/IRF18P4/select?q=*:*&facet=on&facet.query=city:delhi&wt=json
And your code should be,
var delhiCount = client.query
.q('*:*')
.addParams({
facet: 'true',
facet.query: "city:delhi"
wt: 'json',
});
For more help refer,
Resource : https://www.npmjs.com/package/solr-node

Creating Messaging Topic On Cloud Function

I'm trying to create Topic For each newly created groups. So I wrote this function for doing that operation.
exports.createGroupTopic = functions.database.ref("groups/{groupid}/id")
.onWrite(event=>{
var groupid = event.params.groupid;
request({
url: "https://iid.googleapis.com/iid/v1/my_registration_token/rel/topics/topic_name",
headers: {
'Content-Type':'application/json',
'Content-Length': 0,
'Authorization':'my API Key'
}
}, function (error, response, body){
console.log(response);
});
});
But when I run this code I get the following response log on Firebase console..
IncomingMessage {
_readableState:
ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: null,
pipesCount: 0,
flowing: true,
ended: true,
endEmitted: true,
reading: false,
sync: false,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
defaultEncoding: 'utf8',
ranOut: false,
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null },
readable: false,
domain: null,
_events:
{ end: [ [Function: responseOnEnd], [Function] ],
close: [ [Function], [Function] ],
data: [Function],
error: [Function] },
_eventsCount: 4,
_maxListeners: undefined,
socket:
TLSSocket {
_tlsOptions:
{ pipe: null,
secureContext: [Object],
isServer: false,
requestCert: true,
rejectUnauthorized: true,
session: undefined,
NPNProtocols: undefined,
ALPNProtocols: undefined,
requestOCSP: undefined },
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
_SNICallback: null,
servername: null,
npnProtocol: false,
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events:
{ close: [Object],
end: [Object],
finish: [Function: onSocketFinish],
_socketEnd: [Function: onSocketEnd],
secure: [Function],
free: [Function: onFree],
agentRemove: [Function: onRemove],
drain: [Function: ondrain],
error: [Function: socketErrorListener],
data: [Function: socketOnData] },
_eventsCount: 10,
connecting: false,
_hadError: false,
_handle: null,
_parent: null,
_host: 'iid.googleapis.com',
_readableState:
ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: [Object],
length: 0,
pipes: null,
pipesCount: 0,
flowing: true,
ended: true,
endEmitted: true,
reading: false,
sync: false,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
defaultEncoding: 'utf8',
ranOut: false,
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null },
readable: false,
domain: null,
_maxListeners: undefined,
_writableState:
WritableState {
objectMode: false,
highWaterMark: 16384,
needDrain: false,
ending: true,
ended: true,
finished: true,
decodeStrings: false,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function],
writecb: null,
writelen: 0,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 0,
prefinished: true,
errorEmitted: false,
bufferedRequestCount: 0,
corkedRequestsFree: [Object] },
writable: false,
allowHalfOpen: false,
destroyed: true,
_bytesDispatched: 468,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: null,
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage:
ClientRequest {
domain: null,
_events: [Object],
_eventsCount: 5,
_maxListeners: undefined,
output: [],
outputEncodings: [],
outputCallbacks: [],
outputSize: 0,
writable: true,
_last: true,
upgrading: false,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedHeader: [Object],
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [Circular],
connection: [Circular],
_header: 'GET /iid/v1/my_token_id/rel/topics/TOPIC_NAME HTTP/1.1\r\nContent-Type: application/json\r\nContent-Length: 0\r\nAuthorization: api_key\r\nhost: iid.googleapis.com\r\nConnection: close\r\n\r\n',
_headers: [Object],
_headerNames: [Object],
_onPendingData: null,
agent: [Object],
socketPath: undefined,
timeout: undefined,
method: 'GET',
path: '/iid/v1/fphzdEcS_D0:APA91b
Then I ran it again locally And it gave me Invalid Token Error. Then I tested the token to send direct notification. And it's working perfectly.
I don't know where is the problem. SO need help :(
This variation of your code works for me. I added the POST method and prefix key= to the Authorization value. Try it and see if it works for you.
exports.createGroupTopic = functions.database.ref("groups/{groupid}/id")
.onWrite(event => {
var groupid = event.params.groupid;
request({
method: 'POST', // <= ADDED
// ------------------- device token ------------
url: "https://iid.googleapis.com/iid/v1/cAzme9iGTO4:APA91bE...lRbx1yTei2PNFgTYGUQDUTj/rel/topics/someTopic",
headers: {
'Content-Type':'application/json',
'Content-Length': 0,
// Note below. Added: 'key='
// ----------------- server key --------------------------
'Authorization':'key=AAAAXp8june:APA91bF-Nq9pmQKr...HOES6ugO3_Xf-jV472nfn-sb'
}
}, function (error, response, body){
console.log('error:', error);
console.log('statusCode:', response && response.statusCode);
});
});
I used this function to confirm that the topic subscription was added. The returned body contains status for the device, including the topics subscribed to:
exports.checkGroupTopic = functions.database.ref("groups/check")
.onWrite(event => {
const token = 'cAzme9iGTO4:APA91bE...lRbx1yTei2PNFgTYGUQDUTj';
const serverKey = 'AAAAXp8june:APA91bF-Nq9pmQKr...HOES6ugO3_Xf-jV472nfn-sb';
request({
method: 'GET',
url: `https://iid.googleapis.com/iid/info/${token}?details=true`,
headers: {
'Content-Type':'application/json',
'Content-Length': 0,
'Authorization':`key=${serverKey}`
}
}, function (error, response, body){
console.log('error:', error);
console.log('statusCode:', response && response.statusCode);
console.log('body:', body);
});
});

Error when used consolidate node package

I tried to used consolidate package with gulp to build the MEAN stack app. But I don't know why when I run npm install, then gulp browserify, it always threw a lot of exceptions like
Browserify Error { [Error: Cannot find module 'hogan.js' from '<my project path>\node_modules\consolidate\lib']
stream:
{ _readableState:
{ highWaterMark: 16,
buffer: [],
length: 0,
pipes: [Object],
pipesCount: 1,
flowing: true,
ended: false,
endEmitted: false,
reading: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
objectMode: true,
defaultEncoding: 'utf8',
ranOut: false,
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null,
resumeScheduled: false },
readable: true,
domain: null,
_events:
{ end: [Object],
error: [Object],
data: [Function: ondata],
_mutate: [Object] },
_maxListeners: undefined,
_writableState:
{ highWaterMark: 16,
objectMode: true,
needDrain: false,
ending: true,
ended: true,
finished: true,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function],
writecb: null,
writelen: 0,
buffer: [],
pendingcb: 0,
prefinished: true,
errorEmitted: false },
writable: true,
allowHalfOpen: true,
_options: { objectMode: true },
_wrapOptions: { objectMode: true },
_streams: [ [Object], [Object] ],
length: 2,
label: 'deps' } }
[16:01:17] Browserify Error { [Error: Cannot find module 'handlebars' from '<my project path>\node_modules\consolidate\lib']
stream:
{ _readableState:
{ highWaterMark: 16,
buffer: [],
length: 0,
pipes: [Object],
pipesCount: 1,
flowing: true,
ended: false,
endEmitted: false,
reading: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
objectMode: true,
defaultEncoding: 'utf8',
ranOut: false,
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null,
resumeScheduled: false },
readable: true,
domain: null,
_events:
{ end: [Object],
error: [Object],
data: [Function: ondata],
_mutate: [Object] },
_maxListeners: undefined,
_writableState:
{ highWaterMark: 16,
objectMode: true,
needDrain: false,
ending: true,
ended: true,
finished: true,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function],
writecb: null,
writelen: 0,
buffer: [],
pendingcb: 0,
prefinished: true,
errorEmitted: false },
writable: true,
allowHalfOpen: true,
_options: { objectMode: true },
_wrapOptions: { objectMode: true },
_streams: [ [Object], [Object] ],
length: 2,
label: 'deps' } }
[16:01:17] Browserify Error { [Error: Cannot find module 'underscore' from '<my project path>\node_modules\consolidate\lib']
I guess that something wrong in consolidate package, because it did not install package recursively. My consolidate version that I used is 0.12.1. Anyone can help me?
Consolidate does not contain any template engine. You should install them on your level.
I guess you are using hogan templates, so you need to install it. Run this in your project root
npm install hogan.js --save

Resources