Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Error: {error.mod.not_function}' on first level lesson #109

Open
emeraldjava opened this issue Apr 18, 2017 · 2 comments
Open

'Error: {error.mod.not_function}' on first level lesson #109

emeraldjava opened this issue Apr 18, 2017 · 2 comments

Comments

@emeraldjava
Copy link

emeraldjava commented Apr 18, 2017

Hi,

Attempting the first lesson and i have this module defined as '01-level-module.js'

module.exports.someFunction = function someFunction(x,y,callback) {
  callback(null,"ALL YOUR "+x+" ARE BELONG TO "+y);
}

and my client code in '01-level.js' is

var levelme = require("./01-level-module.js");

levelme.someFunction(process.argv[2],process.argv[3],function(err,result) {
	if(err) {
		return console.error(err);
	}
	console.log(result);
});

When i run "levelmeup verify 01-level.js" using node v6.10.1, i get this error

# LEVEL ME UP SCOTTY!

## ALL YOUR BASE (Exercise 1 of 12)

ALL YOUR verify ARE BELONG TO 01-level.js
 # FAIL Your solution to ALL YOUR BASE didn't pass. Try again!


    Error while running run, cause: 
    
    Error: The module doesn't return a function
        at createErrorTemplate (/usr/lib/node_modules/levelmeup/node_modules/exec-module/lib/createErrorTemplate.js:16:15)
        at Timeout._onTimeout (/usr/lib/node_modules/levelmeup/node_modules/exec-module/lib/execAsync.js:32:19)
        at ontimeout (timers.js:380:14)
        at tryOnTimeout (timers.js:244:5)
        at Timer.listOnTimeout (timers.js:214:5)

─────────────────────────────────────────────────────────────────────────────

The full error is

Could not run: Error while running run, cause: 

Error: {error.mod.not_function}
    at createErrorTemplate (/usr/lib/node_modules/levelmeup/node_modules/exec-module/lib/createErrorTemplate.js:16:15)
    at Timeout._onTimeout (/usr/lib/node_modules/levelmeup/node_modules/exec-module/lib/execAsync.js:32:19)
    at ontimeout (timers.js:380:14)
    at tryOnTimeout (timers.js:244:5)
    at Timer.listOnTimeout (timers.js:214:5)`

Can anybody suggest what I'm doing wrong?

@jblacker
Copy link

jblacker commented May 22, 2017

My hint to you is that you're returning a [named] function instead of just exporting a single function.

@martinheidegger
Copy link
Contributor

Yes, this indeed means that the returned module is an object instead of a function. The translation string is written here: https://github.com/workshopper/levelmeup/blob/master/i18n/en.json#L29, maybe you know how to express this problem better? In any case, it should not render {error.mod.not_function} during run. That is a bug in workshopper-adventure 😒

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants