nodejs-mysql-links icon indicating copy to clipboard operation
nodejs-mysql-links copied to clipboard

timeado.js

Open changagp opened this issue 3 years ago • 1 comments
trafficstars

hola buenas: he estado viendo el curso y me esta dando este error, no entiendo por que si la notacion fue actualizada

[email protected] dev nodemon src/index.js

[nodemon] 2.0.15 [nodemon] to restart at any time, enter rs [nodemon] watching path(s): . [nodemon] watching extensions: js,mjs,json [nodemon] starting node src/index.js C:\Users\Berta\Desktop\nodejs-mysql-links-version-2018\src\lib\handlebars.js:2 const timeagoInstance = timeago(); ^

TypeError: timeago is not a function at Object. (C:\Users\Berta\Desktop\nodejs-mysql-links-version-2018\src\lib\handlebars.js:2:25) at Module._compile (node:internal/modules/cjs/loader:1095:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1124:10) at Module.load (node:internal/modules/cjs/loader:975:32) at Function.Module._load (node:internal/modules/cjs/loader:816:12) at Module.require (node:internal/modules/cjs/loader:999:19) at require (node:internal/modules/cjs/helpers:93:18) at Object. (C:\Users\Berta\Desktop\nodejs-mysql-links-version-2018\src\index.js:26:12) at Module._compile (node:internal/modules/cjs/loader:1095:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1124:10) [nodemon] app crashed - waiting for file changes before starting...

changagp avatar Jan 11 '22 22:01 changagp

para que te funcione debes eliminar la linea const timeagoInstance = timeago(); y donde llamas a la función timeagoInstance lo reemplazas con timeago con eso te debiera funcionar a mi me funciono . te quedaria algo asi:

const timeago = require('timeago.js');

const helpers = {};

helpers.timeago = (savedTimestamp) => { return timeago.format(savedTimestamp); };

module.exports = helpers;

sr1994 avatar Feb 01 '22 00:02 sr1994