Could not find a production build in the 'C:\Users\user\Front\my-app\.next' directory
디렉토리에 production 을 build 하지 못하는것 같다.
Command failed with exit code 1.
solv1
1) yarn 으로 생성된 node_modules, yarn.lock 삭제
rm -rf node_modules
rm -rf yarn.lock
2) yarn 공유파일 지우고
yarn cache clean
3) yarn 재설치
yarn
yarn start
solv2
1) yarn 업데이트 후 yarn 시작
yarn update
yarn start
solv3
원인분석 : 코드를 직접 고쳐보자.
sovl? 아직 분석중 🤷♂️
빌드 장소:
NextNodeServer.getBuildId (C:\Users\user\Front\my-app\node_modules\next\dist\server\next-server.js:169:23)
서버create :
NextServer.createServer (C:\Users\user\Front\my-app\node_modules\next\dist\server\next.js:140:16)
//my-app\node_modules\next\dist\server\next-server.js
async createServer(options) {
if (options.dev) {
const DevServer = require("./dev/next-dev-server").default;
return new DevServer(options);
}
const ServerImplementation = await getServerImpl();
return new ServerImplementation(options);
}
//my-app\node_modules\next\dist\server\lib\start-server.js
return new Promise((resolve, reject)=>{
let port = opts.port;
let retryCount = 0;
server.on("error", (err)=>{
if (port && opts.allowRetry && err.code === "EADDRINUSE" && retryCount < 10) {
(0, _log).warn(`Port ${port} is in use, trying ${port + 1} instead.`);
port += 1;
retryCount += 1;
server.listen(port, opts.hostname);
} else {
reject(err);
}
});
let upgradeHandler;
if (!opts.dev) {
server.on("upgrade", (req, socket, upgrade)=>{
upgradeHandler(req, socket, upgrade);
});
}
server.on("listening", ()=>{
const addr = server.address();
const hostname = !opts.hostname || opts.hostname === "0.0.0.0" ? "localhost" : opts.hostname;
const app = (0, _next).default({
...opts,
hostname,
customServer: false,
httpServer: server,
port: addr && typeof addr === "object" ? addr.port : port
});
requestHandler = app.getRequestHandler();
upgradeHandler = app.getUpgradeHandler();
resolve(app);
});
server.listen(port, opts.hostname);
});