Есть проект на Next.js . В режиме разработки все работает нормально. При билдинге - тоже не показывает ошибок. Но когда пытаюсь после билдинга открыть проект npm start - выдает ошибку:
Все зависимости, вроде, установлены.
Файл package.json:
{
"name": "test",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev -H 0.0.0.0 -p 3000",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@hookform/resolvers": "^3.1.1",
"@uidotdev/usehooks": "^2.0.1",
"axios": "^1.4.0",
"browser-cookies": "^1.2.0",
"browser-image-compression": "^2.0.2",
"cookie": "^0.5.0",
"eruda": "^3.0.1",
"eslint": "8.43.0",
"eslint-config-next": "^13.4.15",
"express": "^4.19.2",
"fs": "^0.0.1-security",
"fs.promises": "^0.1.2",
"html-react-parser": "^5.1.7",
"js-cookie": "^3.0.5",
"keen-slider": "^6.8.5",
"next": "^13.4.12",
"next-auth": "^4.22.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.45.1",
"react-input-mask": "^2.0.4",
"react-responsive-carousel": "^3.2.23",
"react-stars": "^2.2.5",
"recursive-readdir-sync": "^1.0.6",
"request-ip": "^3.3.0",
"sass": "^1.63.6",
"sharp": "^0.32.4",
"swr": "^2.2.0",
"yup": "^1.2.0"
},
"devDependencies": {
"@aws-sdk/client-s3": "^3.565.0",
"@svgr/webpack": "^8.1.0",
"dotenv": "^16.4.5"
}
}
Файл recursive-readdir-sync.js, в котором, вроде бы, ошибка:
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "recursiveReadDirSync", {
enumerable: true,
get: function() {
return recursiveReadDirSync;
}
});
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
const _path = require("path");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function recursiveReadDirSync(/** The directory to read */ dir, /** This doesn't have to be provided, it's used for the recursion */ arr = [], /** Used to remove the initial path suffix and leave only the relative, faster than path.relative. */ rootDirLength = dir.length) {
// Use opendirSync for better memory usage
const result = _fs.default.opendirSync(dir);
let part;
while(part = result.readSync()){
const absolutePath = dir + _path.sep + part.name;
if (part.isDirectory()) {
recursiveReadDirSync(absolutePath, arr, rootDirLength);
} else {
arr.push(absolutePath.slice(rootDirLength));
}
}
result.closeSync();
return arr;
}
//# sourceMappingURL=recursive-readdir-sync.js.map