Nodejs +nowjs + Windows - node.js

I tried installing nodejs and it works fine, I was able to get it running.
Followed exactly the steps shown here:
http://blog.nowjs.com/running-nowjs-natively-on-windows
Then I tried to install the nowjs and run the multiroomchat_server.js example and got this error:
[Error: The specified procedure could not be found.
C:\Program Files (x86)\nodejs\node_modules\now\bin\proxy.node]
Error: The specified procedure could not be found.
C:\Program Files (x86)\nodejs\node_modules\now\bin\proxy.node
at Object.Module._extensions..node (module.js:480:11)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object.<anonymous> (C:\Program Files (x86)\nodejs\node_modules\now\lib\pr
oxy.js:10:13)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
I'm running windows 7 64bit, installed the 32bit version of node.js node-v0.8.1-x86.msi.
Anyone got it running?

Try newer version of node.
Works on Win 7 x64 with node-v0.8.5-x64

Related

Error with node site.js

I have problem with log4js.
Problem is that when i ran node.sj error pops up:
Error: Cannot find module 'log4js'
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.<anonymous> (/home/bot/site.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)
So i instaled log4js with:
npm install log4js
And now the real error is here:
/home/bot/node_modules/log4js/lib/log4js.js:25
const debug = require('debug')('log4js:main');
^^^^^
SyntaxError: Use of const in strict mode.
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
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 Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/home/bot/site.js:2:14)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
Maybe i have broken bot. But bot should be OK.
I had this error in past but i fixed it and do not know how. (about 2years ago?) and error was in bot folder i think.
i have Debian 7 installed on server
Thx for response.
which version of node.js are you running?
node --version
First of all try to install your application packages with npm install log4j --save (to save it in your package.json).
It seems that you are using an old version of node.js!
Using this site you can see when the keyword const was introduced without requiring the strict keyword!
http://node.green/#ES2015-bindings-const
To fix the error just need to update your node.js to the latest stable version.
Another solutions: (The previous one is my favourite).
You can set a single specific file to be strict by writing 'use strict' on top of your file.
Or you can force to run your whole application to strict by using node --use_strict index.js (I wont recommend this one)

Error while creating new nodejs project in Netbeans

I have installed express globally and also ran npm update -g and I can create express app using terminal without problems. But when I create a new nodejs project in Netbeans 8.2 I get these errors :
module.js:472
throw err;
^
Error: Cannot find module 'mkdirp'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/bin/express:10:14)
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)
Can someone help me integrate Expressjs properly with netbeans please? Thanks in advance.
[UPDATE]
I figured there is something wrong in the Node path in Netbeans. Can someone tell me what do I add here for Ubuntu :

'The specified module could not be found' error when using 'scrypt' module in node.js

I'm trying to use 'scrypt' module. The problem is that when I try to run my nodejs application (node app.js), I get this error:
C:\Users\A\Documents\B\C>node app.js
module.js:356
Module._extensions[extension](this, filename);
^
Error: The specified module could not be found.
C:\Users\A\Documents\B\C\node_modules\scrypt\build\Release\scry
pt.node
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (C:\Users\A\Documents\B\C\node_module
s\scrypt\index.js:1:76)
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 Module.require (module.js:364:17)
I installed 'scrypt' module with this line:
npm install scrypt -msvs_version=2012
the -msvs_version is taken from this answer
You should have a look at this node-scrypt issue.
According to what is said there, you should be able to solve your problem by
either installing OpenSSL for Windows
or installing and building with Visual Studio 2010

'invalid ELF header' error when loading libyaml module

When I go into node and attempt to require libyaml I get:
> require('libyaml')
Error: /home/ubuntu/shadow/node_modules/libyaml/build/Release/binding.node: invalid ELF header
at Object.Module._extensions..node (module.js:485:11)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object.<anonymous> (/home/ubuntu/shadow/node_modules/libyaml/index.js:7:15)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
I'm using node version 0.8.12 and libyaml version 0.2.1. Curiously the error is server dependent, but it doesn't seem to be based on the version numbers, because it runs fine on one of boxes with the same versions.
One can also use 'npm rebuild module-name' to recompile the C code on the deployment machine as part of preinstall script.
Documentation
Thanks vinayr for advising me to run npm install on the production box. The issue is that they needed to install npm differently. I resolved that with a pre-deploy command on the box as part of the deploy. Problem solved.

Weird Cloudfoundry error

I have a simple node app that I am trying to host on cloudfoundry. I am using the node module srand.
When I visit the url, I get this error.
Error: Cannot find module './build/default/srand.node'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object.<anonymous> (/var/vcap/data/dea/apps/UnfoundedAccusations-0-8f4d453d8731dd95a14f10aeddc17eae/app/node_modules/srand/index.js:4:20)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
Recently cloudfoundry made some changes for Node.js modules support. Have a look at here http://blog.cloudfoundry.com/2012/12/19/recent-changes-in-node-js-modules-support/
You have probably installed the module globally, which is fine for local development but you need to deploy the application with the module.
Before deploying via vmc, run npm install in the project directory.

Resources