(javascript) Iv got an error in running a socket.io example from github .io.git
when i run -> node app.js it says. Error: require.paths is removed. Use node_modules folders, or the NODE_PATH environment variable instead.
can someone tell me whats wrong? this error always es out in every socket.io examples I've tried.
(javascript) Iv got an error in running a socket.io example from github https://github./LearnBoost/socket.io.git
when i run -> node app.js it says. Error: require.paths is removed. Use node_modules folders, or the NODE_PATH environment variable instead.
can someone tell me whats wrong? this error always es out in every socket.io examples I've tried.
Share Improve this question edited Apr 19, 2012 at 13:37 HostileFork says dont trust SE 33.6k13 gold badges102 silver badges174 bronze badges asked Sep 26, 2011 at 17:30 Jude CalimbasJude Calimbas 2,8542 gold badges28 silver badges25 bronze badges3 Answers
Reset to default 6I hit this issue while working with a cloud foundry sample. The offending line they told you to include was:
require.paths.unshift('./node_modules')
It's apparently a way of telling node what path to search in for modules you require
, in those cases where you don't provide an explicit path. I read somewhere that's when the string you pass in does not start with a dot or a slash.
As far as I can tell it's something that is required to make Node 0.4 applications search in the node_modules directory. But in Node 0.6 you're supposed to sort this out with settings in your environment and path instead (though it seemed to work by default for me on an 0.6 install).
I was having trouble because the cloud deployment was on Node 0.4 and my local development setup was on Node 0.6. Having the line crashed me locally, but leaving it out crashed on the cloud. My solution was to delete it and instruct the cloud to use 0.6 with:
vmc push <appname> --runtime=node06
Everything seemed to work after that. Even better: I found that you can edit your manifest.yml file to tell it do this automatically during the push with no mand line switch needed:
---
applications:
.:
name: myapp
runtime: node06 # added this line
framework:
name: node
info:
mem: 64M
description: Node.js Application
exec: n
(etc.)
Incidentally...if it had been necessary to dual support older versions of node that needed require.paths as well, one could maybe run the line conditionally based on testing process.version
:
http://nodejs/docs/v0.4.9/api/process.html#process.version
May be you can try https://github./cloudhead/less.js/issues/320 This is something similar to your problem.
try something like this:
var dust = require('dustjs-helpers');
var piled = dust.pile("Hello {name}!", "intro");
dust.loadSource(piled);
dust.render("intro", {
name: "Márcio"
}, function(err, out) {
console.log(out);
});