Error to create meanjs project with yo Generator - node.js

I am beginner to means js ,I did the setup for meanjs from here.
I have use the following commands to create meanjs project with some question answering.
santosh#santosh:~/Documents/Projects$ yo meanjs
Native thread-sleep not available.
This will result in much slower performance, but it will still work.
You should re-install spawn-sync or upgrade to the lastest version of node if possible.
Check /usr/local/lib/node_modules/yo/node_modules/yeoman-environment/node_modules/inquirer/node_modules/external-editor/node_modules/spawn-sync/error.log for more details
Native thread-sleep not available.
This will result in much slower performance, but it will still work.
You should re-install spawn-sync or upgrade to the lastest version of node if possible.
Check /usr/local/lib/node_modules/yo/node_modules/tabtab/node_modules/inquirer/node_modules/external-editor/node_modules/spawn-sync/error.log for more details
You're using the official MEAN.JS generator.
? What mean.js version would you like to generate? 0.4.0
0.4.0
? In which folder would you like the project to be generated? This can be chang
ed later. mytest
Cloning the MEAN repo.......
? What would you like to call your application? MEAN
? How would you describe your application? Full-Stack JavaScript with MongoDB,
Express, AngularJS, and Node.js
? How would you describe your application in comma seperated key words? MongoDB
, Express, AngularJS, Node.js
? What is your company/author name? santosh
? Would you like to generate the article example CRUD module? Yes
? Would you like to generate the chat example module? Yes
Running npm install for you....
This may take a couple minutes.
Error: stderr maxBuffer exceeded.
at Socket.<anonymous> (child_process.js:686:13)
at Socket.EventEmitter.emit (events.js:95:17)
at Socket.<anonymous> (_stream_readable.js:746:14)
at Socket.EventEmitter.emit (events.js:92:17)
at emitReadable_ (_stream_readable.js:408:10)
at emitReadable (_stream_readable.js:404:5)
at readableAddChunk (_stream_readable.js:165:9)
at Socket.Readable.push (_stream_readable.js:127:10)
at Pipe.onread (net.js:526:21)
santosh#santosh:~/Documents/Projects$
Please tell me why Error: stderr maxBuffer exceeded. are there ?

The problem is most likely related with old Node.js and NPM packages. Update those and the problem should disappear.
A similar problem was solved here.

Related

graphicsmagic not installed in google cloud functions?

i m working in a project in firebase that uses graphics magic to convert images to pdf
it's working fine in local emulator
but doesnt in production
Error: Could not execute GraphicsMagick/ImageMagick: gm "convert" "./0" "./a4.pdf" this most likely means the gm/convert binaries can't be found at ChildProcess. (/workspace/node_modules/gm/lib/command.js:232:12) at ChildProcess.emit (events.js:198:13) at ChildProcess.EventEmitter.emit (domain.js:448:20) at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12) at onErrorNT (internal/child_process.js:415:16) at process._tickCallback (internal/process/next_tick.js:63:19)
knowing that in the cloud functions documentation they said that graphics magic is included in the environement
see : https://cloud.google.com/functions/docs/tutorials/imagemagick
Edit : gm requires installation (apt get install), i can't do that in cloud functions , cuz i dont have access to the machine.
i'm working now with pdfkit, its does the same job and doesnt require installation (requires npm install tho)
You are supposed to include gm on your dependencies. You can do so by running:
npm install gm
And have your dependencies look like:
"dependencies": {
"#google-cloud/storage": "^5.0.0",
"#google-cloud/vision": "^2.0.0",
"gm": "^1.23.1"
}
I just followed this documentation and it's working fine on Nodejs10 runtime.
UPDATE: It looks like there's an open issue on GitHub about this problem. I suggest you put a comment in there and provide detailed information similar to what the reporter did.

How to create node.js project to standalone exe file for windows.

I have built an application in Node js which uses Websockets for communicating events to browser. I want to bundle that application into one .exe file so that it can run on client machine without Node being installed.
I googled few approaches and finally used Nexe for bundling.
All goes fine but when I am running the output file it is giving issue with Websocket module.
TypeError: WebSocketServer is not a function
at Array.__dirname.call.C:\Users\Raghav Tandon\WinPos\BrowserIntegrat
ion\js\RestImpl.js.http (nexe.js:15287:12)
at initModule (nexe.js:29:11)
at nexe.js:31:64
at Array.__dirname.call.C:\Users\Raghav Tandon\WinPos\BrowserIntegrat
ion\js\RestWS.js../RestImpl (nexe.js:48:20)
at initModule (nexe.js:29:11)
at Array.forEach (native)
at nexe.js:39:8
at nexe.js:46:4
at NativeModule.compile (node.js:945:5)
at Function.NativeModule.require (node.js:893:18)
Can electron will work?
Please, help me on how do I bundle the Node application to an .exe file.
Please share the best practices to do this. TIA
According to nexe docs:
Doesn't support native modules
nexe is not yet supported native modules. So, your case would not work because which uses natvie modules.
Alternatively, if you don't care paying costs, enclosejs would be help you.

moment-isocalendar not working

According to their documentation, all one needs to do is require the moment-isocalendar module.
This does not work:
var m = require("moment");
var i = require("moment-isocalendar");
m().isocalendar();
It throws
TypeError: Object Tue Aug 13 2013 18:20:36 GMT+0300 has no method 'isocalendar'
at repl:1:6
at REPLServer.self.eval (repl.js:110:21)
at Interface.<anonymous> (repl.js:239:12)
at Interface.EventEmitter.emit (events.js:95:17)
at Interface._onLine (readline.js:202:10)
at Interface._line (readline.js:531:8)
at Interface._ttyWrite (readline.js:760:14)
at ReadStream.onkeypress (readline.js:99:10)
at ReadStream.EventEmitter.emit (events.js:98:17)
at emitKey (readline.js:1095:12)
I looked at the module (all were installed with npm), and it requires the "moment" and monkey-patches it. I tried requiring the moment-isocalendar before the moment module, but got the same result. The moment-isocalendar is an empty object after the monkey-patch {}.
Has anyone used a momentjs plugin in nodejs before? Any ideas how to make this work?
Later edit
It works in nodejs v0.10.12, it doesn't work in nodejs v0.10.15. I added an answer.
Later edit
I'm running Ubuntu 13.04 with 3.8.0-26-generic kernel, and the nodejs is installed via package manager from ppa:chris-lea/node.js
moment-isocalendar is a plugin, not part of the main moment.js library. My guess is that they didn't update it for the last moment.js release, but I have not verified this.
You should raise an issue here: https://github.com/fusionbox/moment-isocalendar
After a little research, the answer is simple: it is not working. It was relying on an older nodejs feature (bug) where you could monkey-patch the in-memory modules after their first require, which apparently doesn't work anymore (worked in 0.10.12, doesn't work in 0.10.15).
If anyone gets the module as-is working i'll change the right answer.

node.js:201 process.nextTick error?

So I'm messing around with meteor, and out of no where I received this error? What is it asking me to change?
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
SyntaxError: Unexpected end of input
at /Users/devinandrews/my_cool_app/.meteor/local/build/server/server.js:109:21
at Array.forEach (native)
at Function.<anonymous>(/Users/devinandrews/my_cool_app/.meteor/local/build/server/underscore.js:76:11)
at /Users/devinandrews/my_cool_app/.meteor/local/build/server/server.js:95:7
Exited with code: 1
Your application is crashing. Waiting for file change.
Thanks guys..
You need to look through the code and see what it's doing in server.js around 109. It is probably working with a network connection that is being abruptly terminated. Are you doing anything like accessing your site with curl and CTRL-C-ing it while it's connected to your server? Because of the disconnected nature of vanilla node.js stack traces, we need to see the code to help you debug this.
This error comes up when you have a syntax error. Perhaps you are missing a closing brace in server.js?
Check that you don't have duplicate and possibly conflicting versions of modules in your global and local paths.
npm list
and
npm list -g
should not list duplicate and/or conflicting versions of modules.
In my case I had ws installed locally and some of its dependencies were also on the global path.
My solution was to remove everything from my local path and just install everything globally.
I've came across this error when I tried to start my server running on ubuntu on a well-known port (0-1023)
If that's the case, just run it as superuser (sudo)
In case that's not possible for you, check out this alternative (https://serverfault.com/a/112798)
in my experience was getting that error, caused by NPM and Node are not match version.
Need make sure NPM and Node are match (not mean same version)

Node.js Crawler Error

I'm on Mac OSX and I've been trying to use Node.js with Crawler. Now i've just installed following steps as it instructed:
git clone git://github.com/ry/node.git
cd node
./configure
make
sudo make install
curl http://npmjs.org/install.sh | sh
npm install crawler
As soon as i've installed the last one (Crawler), when i test run the test/simple.js as in its sample, i'm getting following errors:
The "sys" module is now called "util". It should have a similar interface.
http://jamendo.com/
http://tedxparis.com
/crawler/node_modules/crawler/lib/crawler.js:74
response.body = body;
^
TypeError: Cannot set property 'body' of undefined
at Object.callback (/crawler/node_modules/crawler/lib/crawler.js:74:39)
at Request._callback (/crawler/node_modules/crawler/lib/crawler.js:70:43)
at /crawler/node_modules/crawler/node_modules/request/main.js:119:22
at Request.<anonymous> (native)
at Request.emit (events.js:67:17)
at Object._onTimeout (/crawler/node_modules/crawler/node_modules/request/main.js:532:12)
at Timer.ontimeout (timers.js:84:39)
This means the Crawler doesn't work yet. How can i fix it?
You have a few options:
Try a newer version of Crawler
Use an older version of Node
Use a different module (recommended, as Crawler is very out of date)
Fix Crawler yourself (and submit your patches!, but it seems nobody is maintaining this project anymore)
If this is just a one-time error, you can wrap the whole thing in a try/catch and handle it as needed.
You may also be interested in trying my Node Crawler (https://github.com/ecdeveloper/node-web-crawler). It's not a module but an independent web app. It uses Mongo, Express, Socket.io, Twitter bootstrap.

Resources