Nodejs Construindo API´s Rest

Estou fazendo o código do livro mas está dando o seguinte erro:
C:\Users\m\ntask-api\node_modules\consign\lib\consign.js:121

  ^

Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Users\m\ntask-api\models\tasks.js from C:\Users\m\ntask-api\node_modules\consign\lib\consign.js not supported.
tasks.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains “type”: “module” which declares all .js files in that package scope as ES modules.
Instead either rename tasks.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change “type”: “module” to “type”: “commonjs” in C:\Users\m\ntask-api\package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).

at Object.newLoader [as .js] (C:\Users\m\ntask-api\node_modules\pirates\lib\index.js:121:7)
at Consign.into (C:\Users\m\ntask-api\node_modules\consign\lib\consign.js:232:15)
at file:///C:/Users/m/ntask-api/index.js:14:3 {

code: ‘ERR_REQUIRE_ESM’
}

index.js
import express from ‘express’;

import consign from ‘consign’;

const app = express();

consign()

.include(“models”)

.then(“libs/middlewares.js”)

.then(“routes”)

.then(“libs/boot.js”)

.into(app);

route
index.js
const tasks = require(“…/models/tasks”);

module.exports = app =>{
app.get(“/”, (req, res) =>{
res.json({status: “NTask API”});
});
};

module.exports = app => {
const Tasks = app.models.tasks;
app.get(“/tasks”, (req,res) => {
Tasks.findAll({}, (tasks) => {
res.json({tasks: tasks});
});
});
};

tasks.js
module.exports= app =>{
const Tasks = app.models.tasks;
app.get(“/tasks”, (req, res) => {
Tasks.findAll({}, (tasks) => {
res.json({tasks: tasks});
});
});
};

models
tasks.js
module.exports = app => {
return{
findAll:(params, callback) =>{
return callback([
{title: “Fazer Compras”},
{title: “Consertar o pc”},
]);
}
};
};