Welcome to the Linux Foundation Forum!

Error in lab 7.1

lcabello
lcabello Posts: 1
edited September 21 in LFW211 Class Forum

Hi everyone,

I'm getting an error in the lab 7.1 after execute test.mjs. My code is using commonjs to export the function, where is my mistake coming from?

Error message:
_node:internal/process/esm_loader:97
internalBinding('errors').triggerUncaughtException(
^

AssertionError [ERR_ASSERTION]: function exported
at file:///Users/lcabello/projects/node/NodeJs/labs-empty/ch-7/labs-1/test.mjs:6:1 {
generatedMessage: false,
code: 'ERR_ASSERTION',
actual: false,
expected: true,
operator: '=='
}_

Here a simple example

//Index.js
const { add } = require('./sum');

console.log(add(1,2));

//Sum.js
'use strict';

const add = (a,b) => a + b;

module.exports = { add };

Thanks!

Categories

Upcoming Training