• 카테고리

    질문 & 답변
  • 세부 분야

    풀스택

  • 해결 여부

    미해결

front 서버 npm run build 중에 발생한 에러들

24.05.09 12:09 작성 조회수 60

0

안녕하세요 제로초님

front 서버를 빌드하던중에 빌드가 된줄알고 pm2 monit으로 확인해보니 Could not find a production build in the '.next' directory 이런 에러가 떠있었습니다.
확인해봤더니 아래와 같은 에러 들이 엄청 나오더라구요.
warning도 아니고 다 error들이라

검색해보고 .eslintrc를 고쳐봤는데도 잘 안되서 여쭤봅니다 ㅠ 다른 분들은 이런 에러 없이 잘 되는거같은데 전 왜이런지 도와주시면 감사하겠습니다 ㅠ ㅠ

 

npm run build 했을때 나타나는 에러중 일부

/components/LoginForm.js
11:1  Error: Unexpected tab character.  no-tabs
14:1  Error: Unexpected tab character.  no-tabs
17:19  Error: Function component is not a function declaration  react/function-component-definition
18:1  Error: Unexpected tab character.  no-tabs
18:1  Error: Expected indentation of 2 spaces but found 1 tab.  indent
19:1  Error: Unexpected tab character.  no-tabs
19:1  Error: Expected indentation of 4 spaces but found 2 tabs.  indent
20:1  Error: Unexpected tab character.  no-tabs
20:1  Error: Expected indentation of 4 spaces but found 2 tabs.  indent
21:1  Error: Unexpected tab character.  no-tabs
21:1  Error: Expected indentation of 4 spaces but found 2 tabs.  indent
22:1  Error: Unexpected tab character.  no-tabs
22:1  Error: Expected indentation of 2 spaces but found 1 tab.  indent
23:1  Error: Unexpected tab character.  no-tabs
23:1  Error: Expected indentation of 2 spaces but found 1 tab.  indent
25:1  Error: Unexpected tab character.  no-tabs
25:1  Error: Expected indentation of 2 spaces but found 1 tab.  indent
26:1  Error: Unexpected tab character.  no-tabs
26:1  Error: Expected indentation of 4 spaces but found 2 tabs.  indent
27:1  Error: Unexpected tab character.  no-tabs
27:1  Error: Expected indentation of 6 spaces but found 3 tabs.  indent
27:4  Warning: Unexpected alert.  no-alert
28:1  Error: Unexpected tab character.  no-tabs
28:1  Error: Expected indentation of 4 spaces but found 2 tabs.  indent
29:1  Error: Unexpected tab character.  no-tabs
29:1  Error: Expected indentation of 2 spaces but found 1 tab.  indent
31:1  Error: Unexpected tab character.  no-tabs
31:1  Error: Expected indentation of 2 spaces but found 1 tab.  indent
32:1  Error: Unexpected tab character.  no-tabs
32:1  Error: Expected indentation of 2 spaces but found 1 tab.  indent
33:1  Error: Unexpected tab character.  no-tabs
33:1  Error: Expected indentation of 4 spaces but found 2 tabs.  indent
34:1  Error: Unexpected tab character.  no-tabs
34:1  Error: Expected indentation of 2 spaces but found 1 tab.  indent
36:1  Error: Unexpected tab character.  no-tabs
36:1  Error: Expected indentation of 2 spaces but found 1 tab.  indent
37:1  Error: Unexpected tab character.  no-tabs
37:3  Error: Expected indentation of 2 space characters but found 0.  react/jsx-indent
38:1  Error: Unexpected tab character.  no-tabs
38:4  Error: Expected indentation of 2 space characters but found 0.  react/jsx-indent
39:1  Error: Unexpected tab character.  no-tabs
39:5  Error: Expected indentation of 2 space characters but found 0.  react/jsx-indent
39:20  Error: Unexpected usage of singlequote.  jsx-quotes
40:1  Error: Unexpected tab character.  no-tabs
40:5  Error: Expected indentation of 2 space characters but found 0.  react/jsx-indent
41:1  Error: Unexpected tab character.  no-tabs
41:5  Error: Expected indentation of 2 space characters but found 0.  react/jsx-indent
42:1  Error: Unexpected tab character.  no-tabs
42:6  Error: Expected indentation of 2 space characters but found 0.  react/jsx-indent-props
42:11  Error: Unexpected usage of singlequote.  jsx-quotes
43:1  Error: Unexpected tab character.  no-tabs
43:6  Error: Expected indentation of 2 space characters but found 0.  react/jsx-indent-props
44:1  Error: Unexpected tab character.  no-tabs
44:6  Error: Expected indentation of 2 space characters but found 0.  react/jsx-indent-props
45:1  Error: Unexpected tab character.  no-tabs
45:1  Error: Expected indentation of 7 spaces but found 6 tabs.  indent
46:1  Error: Unexpected tab character.  no-tabs
46:1  Error: Expected indentation of 7 spaces but found 6 tabs.  indent
47:1  Error: Unexpected tab character.  no-tabs
48:1  Error: Unexpected tab character.  no-tabs
48:6  Error: Expected indentation of 2 space characters but found 0.  react/jsx-indent-props
49:1  Error: Unexpected tab character.  no-tabs
49:7  Error: Expected indentation of 2 space characters but found 0.  react/jsx-indent
50:1  Error: Unexpected tab character.  no-tabs
50:8  Error: Expected indentation of 2 space characters but found 0.  react/jsx-indent
50:29  Error: Unexpected usage of singlequote.  jsx-quotes
50:42  Error: Unexpected usage of singlequote.  jsx-quotes
50:62  Error: Unexpected usage of singlequote.  jsx-quotes
51:1  Error: Unexpected tab character.  no-tabs
51:8  Error: Expected indentation of 2 space characters but found 0.  react/jsx-indent
52:1  Error: Unexpected tab character.  no-tabs
53:1  Error: Unexpected tab character.  no-tabs
54:1  Error: Unexpected tab character.  no-tabs
55:1  Error: Unexpected tab character.  no-tabs
56:1  Error: Unexpected tab character.  no-tabs
56:4  Error: Expected indentation of 2 space characters but found 0.  react/jsx-indent
57:1  Error: Unexpected tab character.  no-tabs
57:5  Error: Expected indentation of 2 space characters but found 0.  react/jsx-indent
57:20  Error: Unexpected usage of singlequote.  jsx-quotes
58:1  Error: Unexpected tab character.  no-tabs
58:5  Error: Expected indentation of 2 space characters but found 0.  react/jsx-indent
59:1  Error: Unexpected tab character.  no-tabs
59:5  Error: Expected indentation of 2 space characters but found 0.  react/jsx-indent
60:1  Error: Unexpected tab character.  no-tabs
60:6  Error: Expected indentation of 2 space characters but found 0.  react/jsx-indent-props
60:11  Error: Unexpected usage of singlequote.  jsx-quotes
61:1  Error: Unexpected tab character.  no-tabs
61:6  Error: Expected indentation of 2 space characters but found 0.  react/jsx-indent-props
62:1  Error: Unexpected tab character.  no-tabs
62:6  Error: Expected indentation of 2 space characters but found 0.  react/jsx-indent-props
63:1  Error: Unexpected tab character.  no-tabs
63:1  Error: Expected indentation of 7 spaces but found 6 tabs.  indent
64:1  Error: Unexpected tab character.  no-tabs
64:1  Error: Expected indentation of 7 spaces but found 6 tabs.  indent
65:1  Error: Unexpected tab character.  no-tab
 

 

.eslintrc, next.config.js 는 제로초님의 깃헙과 동일하게 했습니다.

.eslintrc

{
	"parser": "@babel/eslint-parser",
	"parserOptions": {
		"ecmaVersion": 2020,
		"sourceType": "module",
		"ecmaFeatures": {
			"jsx": true
		},
		"babelOptions": {
			"presets": ["next/babel"]
		},
		"requireConfigFile": false
	},
	"env": {
		"browser": true,
		"node": true,
		"es6": true
	},
	"extends": ["airbnb"],
	"plugins": ["import", "react-hooks", "jsx-a11y"],
	"rules": {
		"jsx-a11y/label-has-associated-control": "off",
		"jsx-a11y/anchor-is-valid": "off",
		"no-console": "off",
		"no-underscore-dangle": "off",
		"react/forbid-prop-types": "off",
		"react/jsx-filename-extension": "off",
		"react/jsx-one-expression-per-line": "off",
		"react/jsx-props-no-spreading": "off",
		"object-curly-newline": "off",
		"linebreak-style": "off",
		"no-param-reassign": "off",
		"max-len": "off",
		"react/react-in-jsx-scope": "off"
	}
}

next.config.js

const withBundleAnalyzer = require("@next/bundle-analyzer")({
	enabled: process.env.ANALYZE === "true",
});

module.exports = withBundleAnalyzer({
	images: {
		domains: ["react-nodebird.s3.ap-northeast-2.amazonaws.com", "react-nodebird-s3.s3.amazonaws.com"],
	},
	compress: true,
	compiler: {
		styledComponents: {
			ssr: true,
			displayName: true,
		},
	},
	webpack(config, { webpack }) {
		const prod = process.env.NODE_ENV === "production";
		return {
			...config,
			mode: prod ? "production" : "development",
			devtool: prod ? "hidden-source-map" : "inline-source-map",
			plugins: [...config.plugins],
		};
	},
});

 

/package.json

{
	"name": "react-nodebird",
	"version": "1.0.0",
	"description": "",
	"main": "index.js",
	"scripts": {
		"dev": "next dev",
		"build": "cross-env ANALYZE=true NODE_ENV=production next build",
		"start": "cross-env NODE_ENV=production next start -p 80"
	},
	"author": "",
	"license": "MIT",
	"dependencies": {
		"@ant-design/icons": "^5.3.6",
		"@next/bundle-analyzer": "^14.2.3",
		"@reduxjs/toolkit": "^2.2.3",
		"antd": "^5.8.3",
		"axios": "^1.6.8",
		"babel-plugin-styled-components": "^2.1.4",
		"cross-env": "^7.0.3",
		"dayjs": "^1.11.11",
		"lodash": "^4.17.21",
		"next": "^14.2.3",
		"next-redux-wrapper": "^8.1.0",
		"pm2": "^5.3.1",
		"prop-types": "^15.8.1",
		"react": "^18.3.1",
		"react-dom": "^18.3.1",
		"react-hook-form": "^7.51.3",
		"react-redux": "^9.1.1",
		"react-slick": "^0.30.2",
		"redux": "^5.0.1",
		"redux-saga": "^1.3.0",
		"shortid": "^2.2.16",
		"styled-components": "^6.1.8",
		"swr": "^2.2.5"
	},
	"devDependencies": {
		"@babel/eslint-parser": "^7.24.5",
		"@faker-js/faker": "^8.4.1",
		"babel-eslint": "^10.1.0",
		"eslint": "^8.57.0",
		"eslint-config-airbnb": "^19.0.4",
		"eslint-plugin-import": "^2.29.1",
		"eslint-plugin-jsx-a11y": "^6.8.0",
		"eslint-plugin-react": "^7.34.1",
		"eslint-plugin-react-hooks": "^4.6.2"
	}
}

 

깃헙 : https://github.com/dydcodydco/react-nodebird

답변 1

답변을 작성해보세요.

0

LoginForm.js에서 스페이스 대신 탭이 들어간 것 같은데요. 에디터 문제가 아닐까싶기도 하네요. 파일 인덴테이션 정리하고 다시 커밋해서 해보세요.