Giter VIP home page Giter VIP logo

Comments (14)

thetutlage avatar thetutlage commented on July 3, 2024

What error is thrown and can you also show how your provider looks

from core.

amirkheirabadi73 avatar amirkheirabadi73 commented on July 3, 2024

this is tace

error: uncaughtException: Unexpected identifier 
{ date: 'Thu Oct 08 2015 10:32:32 GMT+0330 (IRST)',
  process: 
   { pid: 11489,
     uid: 1000,
     gid: 100,
     cwd: '/home/amir/Desktop/test',
     execPath: '/home/amir/.nvm/versions/io.js/v3.3.1/bin/iojs',
     version: 'v3.3.1',
     argv: 
      [ '/home/amir/.nvm/versions/io.js/v3.3.1/bin/iojs',
        '/home/amir/Desktop/test/server.js' ],
     memoryUsage: { rss: 32239616, heapTotal: 16486912, heapUsed: 8283336 } },
  os: { loadavg: [ 0.8828125, 0.9150390625, 1.375 ], uptime: 1798 },
  trace: 
   [ { column: 16,
       file: 'vm.js',
       function: 'exports.runInThisContext',
       line: 53,
       method: 'runInThisContext',
       native: false },
     { column: 25,
       file: 'module.js',
       function: 'Module._compile',
       line: 413,
       method: '_compile',
       native: false },
     { column: 10,
       file: 'module.js',
       function: 'Object.Module._extensions..js',
       line: 448,
       method: 'Module._extensions..js',
       native: false },
     { column: 32,
       file: 'module.js',
       function: 'Module.load',
       line: 355,
       method: 'load',
       native: false },
     { column: 12,
       file: 'module.js',
       function: 'Function.Module._load',
       line: 310,
       method: 'Module._load',
       native: false },
     { column: 17,
       file: 'module.js',
       function: 'Module.require',
       line: 365,
       method: 'require',
       native: false },
     { column: 17,
       file: 'module.js',
       function: 'require',
       line: 384,
       method: null,
       native: false },
     { column: 13,
       file: '/home/amir/Desktop/test/bootstrap/http.js',
       function: '',
       line: 14,
       method: null,
       native: false },
     { column: 26,
       file: 'module.js',
       function: 'Module._compile',
       line: 430,
       method: '_compile',
       native: false },
     { column: 10,
       file: 'module.js',
       function: 'Object.Module._extensions..js',
       line: 448,
       method: 'Module._extensions..js',
       native: false } ],
  stack: 
   [ 'SyntaxError: Unexpected identifier',
     '    at exports.runInThisContext (vm.js:53:16)',
     '    at Module._compile (module.js:413:25)',
     '    at Object.Module._extensions..js (module.js:448: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/amir/Desktop/test/bootstrap/http.js:14:13)',
     '    at Module._compile (module.js:430:26)',
     '    at Object.Module._extensions..js (module.js:448:10)' ] }

from core.

amirkheirabadi73 avatar amirkheirabadi73 commented on July 3, 2024

sorry ...
/provider/Challenge/provier.js

'use strict'

const ServiceProvider = require('adonis-fold').ServiceProvider
const Challenge = require('./Challenge')

class ChallengeProvider extends ServiceProvider {

    * register() {

        this.app.bind('Challenge/Challenge', function() {
            return new Challenge()
        })

    }

}

from core.

thetutlage avatar thetutlage commented on July 3, 2024

There is some syntax error in your Challenge.js file.

Here's is the problem

The reason you are not able to see the exact error is , v8 removes the filename from error stack and node is not able to get it back. Check out this thread
nodejs/node-v0.x-archive#3452

from core.

amirkheirabadi73 avatar amirkheirabadi73 commented on July 3, 2024

my challenge.js

'use strict'


class Challenge {

    * getTime() {
        return new Date().getTime;
    }

}


module.exports = Challenge

i don't think the related to my class

from core.

thetutlage avatar thetutlage commented on July 3, 2024

There is some syntax error as the stack trace states. I created a quick repo with your service provider and it works fine.

Try cloning this https://github.com/thetutlage/adonis-issue-7

Not getting the filename for error is inconvenience but that is by v8 itself.

from core.

amirkheirabadi73 avatar amirkheirabadi73 commented on July 3, 2024

wwwwow thx
but also data that my function return in challenge class is empty array in homecontroller ...

from core.

thetutlage avatar thetutlage commented on July 3, 2024

Any chance of sharing your code repo , or a copy of your code ?

from core.

amirkheirabadi73 avatar amirkheirabadi73 commented on July 3, 2024

no also
https://github.com/thetutlage/adonis-issue-7
has this error ...

my homecontroller

'use strict'

const ch = use('Challenge/Challenge')

class HomeController {

    * index(request, response) {
        return ch.getTime()
    }
}

module.exports = HomeController

from core.

thetutlage avatar thetutlage commented on July 3, 2024

https://github.com/thetutlage/adonis-issue-7 works fine for me and as it is a syntax error it will have nothing to do with version of node or npm

from core.

thetutlage avatar thetutlage commented on July 3, 2024

Also getTime is generator function , so you have to prepend it with yield

from core.

amirkheirabadi73 avatar amirkheirabadi73 commented on July 3, 2024

thx ... every thing work fine ....

from core.

thetutlage avatar thetutlage commented on July 3, 2024

👍

from core.

lock avatar lock commented on July 3, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

from core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.