No se puede cargar el script node.js en openshif

I have a simple script called countries.js under routes folder in my application. It fails to start because this line in index.js

 var countries = require('./countries'); 

locally everything works ok. how do I load my own scripts in openshift? files structure :

-app-directory
|
\ public
|
\ views
|
\ routes
   |
   \ index.js
   |
   \ countries.js
|
\ package.json
|
\ server.js 

¿algunas ideas?

preguntado el 29 de julio de 12 a las 08:07

What does your server.js look like - are you launching your application from there? -

1 Respuestas

I can't say I've ever used openshift. You might try adding the .js extension in your require statement. If that doesn't work and I was faced with your dilemma I would try the following, which should work on any platform, albeit it is a bit explicit.

var path      = require('path'),
    countries = require(path.resolve(path.join('.','countries.js')));

If that still doesn't work I'd suggest you start asking your hosting provider questions.

Respondido 03 ago 12, 19:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.