These are my imports:
import mongoose from ‘mongoose’;
import express from ‘express’;
import config from ‘config’;
import cookieParser from ‘cookie-parser’;
import authRouter from ‘…/server/routes/auth.routes.js’;
And when I try to deploy the code from Git repo, I get such an error on all my attempts;
1:04:42 AM: $ node index.js
1:04:42 AM: node:internal/errors:478
1:04:42 AM: ErrorCaptureStackTrace(err);
1:04:42 AM: ^
1:04:42 AM: Error [ERR_MODULE_NOT_FOUND]: Cannot find module ‘/opt/build/server/routes/auth.routes.js’ imported from /opt/build/repo/index.js
1:04:42 AM: at new NodeError (node:internal/errors:387:5)
1:04:42 AM: at finalizeResolution (node:internal/modules/esm/resolve:330:11)
1:04:42 AM: at moduleResolve (node:internal/modules/esm/resolve:907:10)
1:04:43 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
1:04:42 AM: at defaultResolve (node:internal/modules/esm/resolve:1115:11)
1:04:42 AM: at nextResolve (node:internal/modules/esm/loader:163:28)
1:04:42 AM: at ESMLoader.resolve (node:internal/modules/esm/loader:841:30)
1:04:42 AM: at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
1:04:42 AM: at ModuleWrap. (node:internal/modules/esm/module_job:76:40)
1:04:42 AM: at link (node:internal/modules/esm/module_job:75:36) {
1:04:42 AM: code: ‘ERR_MODULE_NOT_FOUND’
What may be a problem?