Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

413
Visualizações
Object has no method 'createApp'

I'm new to Javascript. I'm trying to load the following script using Node.js (ver. 0.8.8, it has to be done in this specific version), OS - Windows 10:

//require('look').start();
var main = require('skilap-core');
if (process.argv[2]=="automated") {
    process.on("message",function (msg) {
        if (msg.c == "startapp") {
            var app = main.createApp(msg.data);
            app.startApp(__dirname+"/data",function (err) {
                process.send({c:"startapp_repl",data:err})
            });
        }
    })
} else {
    var app = main.createApp();
    app.startApp(__dirname+"/data",function (err) {
        if (err) console.log(err);
    });
    module.exports = app;
}

But I get the following error:

> TypeError: Object #<Object> has no method 'createApp'
    at Object.<anonymous> D:\Downloads\skilap\skilap\app.js:13:17)
    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.runMain (module.js:492:10)
    at process.startup.processNextTick.process._tickCallback(node.js:244:9)

As I understand, the module loads correctly, but doesn't compile. I've done research in the web and also saw other related questions on this site, but I cannot see what the problem actually is. What does the error mean and what needs to be changed to launch the app? Any help would be appreciated.

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

You require a module I've never heard of:

var main = require('skilap-core');

This is a javascript object. In your code you are trying to call a createApp() method on that object:

var app = main.createApp();

The main object does not have the createApp() function.

I would use a debugger or insert a console.log(main) after the require to see what the object actually looks like.

I used npm pack skilap-core to download it as a tgz file and examine it. There doesn't appear to be a createApp() function at all. It appears to want to take some kind of custome webapp as a parameter:

module.exports = function (webapp) {
    var app = webapp.web;
    var ctx = webapp._ctx;
    var prefix = webapp.prefix;
    var api = webapp;

    app.get(prefix, function (req, res, next) {
        res.redirect(prefix+"/user");
    })

    app.get("/", webapp.layout(), function(req, res, next) {
    ...
about 4 years ago · Juan Pablo Isaza Relatório

0

I changed the line var main = require('skilap-core') to var main = require('./modules/core/lib/core.js') (the path to the module file) and the module started working.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda