Strapi5 upgarde - cron script shows
Module '"@strapi/strapi"' has no exported member 'Strapi'.
npm run build
npm verbose cli /usr/bin/node /usr/local/bin/npm
npm info using npm@11.2.0
npm info using node@v20.18.2
npm warn Unknown project config "python". This will stop working in the next major version of npm.
npm warn Unknown global config "python". This will stop working in the next major version of npm.
npm verbose title npm run build
npm verbose argv "run" "build"
npm verbose logfile logs-max:10 dir:/home/ndipiazza/.npm/_logs/2025-03-06T22_49_55_198Z-
npm verbose logfile /home/ndipiazza/.npm/_logs/2025-03-06T22_49_55_198Z-debug-0.log
> gha-strapi@0.2.0 build
> strapi build
⠋ Compiling TSconfig/cron-tasks.ts:1:10 - error TS2305: Module '"@strapi/strapi"' has no exported member 'Strapi'.
1 import { Strapi } from "@strapi/strapi";
~~~~~~
Found 1 error(s).
{
"error": {
"code": 1,
"summary": "",
"detail": ""
}
}
npm verbose cwd /home/ndipiazza/gha-strapi
npm verbose os Linux 5.15.167.4-microsoft-standard-WSL2
npm verbose node v20.18.2
npm verbose npm v11.2.0
npm verbose exit 1
npm verbose code 1
Here is the cron ts file:
[ndipiazza@bbe9c5df27c0 gha-strapi]$ cat config/cron-tasks.ts
import { Strapi } from "@strapi/strapi";
export default {
unpublishExpiredNews: {
task: async ({ strapi }: { strapi: Strapi }) => {
await strapi.db.query("api::news-item.news-item").updateMany({
where: { ExpirationDate: { $lte: new Date() } },
data: { publishedAt: null },
});
},
options: {
// Run daily at 3 AM
rule: "0 0 3 * * *",
},
},
};
am i missing some step?