• 카테고리

    질문 & 답변
  • 세부 분야

    풀스택

  • 해결 여부

    미해결

npm run build:prod 에러

22.12.18 01:10 작성 22.12.18 01:19 수정 조회수 945

0

ec2 instance connect 에서 npm run build:prod 시 에러가 뜹니다

ubuntu@ip-172-31-7-125:~/raddit-clone-deploy/client$ npm run build:prod

> client@0.1.0 build:prod
> env-cmd -f .env.production next build

info  - Loaded env from /home/ubuntu/raddit-clone-deploy/client/.env.production

Failed to compile.

./src/pages/_app.tsx
31:3  Error: Synchronous scripts should not be used. See: https://nextjs.org/docs/messages/no-sync-scripts  @next/next/no-sync-scripts

./src/pages/index.tsx
42:5  Warning: React Hook useEffect has missing dependencies: 'observeElement' and 'observedPost'. Either include them or remove the dependency array.  react-hooks/exhaustive-deps

./src/pages/r/[sub].tsx
28:7  Warning: React Hook useEffect has missing dependencies: 'authenticated' and 'user'. Either include them or remove the dependency array.  react-hooks/exhaustive-deps

info  - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
info  - Linting and checking validity of types .ubuntu@ip-172-31-7-125:~/raddit-clone-deploy/client$ ^C
31:3  Error: Synchronous scripts should not be used. See: https://nextjs.org/docs/messages/no-sync-scripts 

여기서 async 나 defer 추가하래서

client>src>pages>_app.tsx에서

return <>
  <Head>
  <script defer src="https://kit.fontawesome.com/0d9816814b.js" crossOrigin="anonymous"></script>
  </Head>
  
  <SWRConfig
    value = {{
      fetcher
    }}>
<script defer src="https://kit.fontawesome.com/0d9816814b.js" crossOrigin="anonymous"></script>

추가해보았지만 해결이 안되었습니다.

선생님 소스코드 보니 integrity가 추가되었는데 이게 문제일까요?

 <script defer src="https://use.fontawesome.com/releases/v6.1.1/js/all.js" integrity="sha384-xBXmu0dk1bEoiwd71wOonQLyH+VpgR1XcDH3rtxrLww5ajNTuMvBdL5SOiFZnNdp" crossOrigin="anonymous"></script>

답변 1

답변을 작성해보세요.

1

안녕하세요 은영님
혹시
.eslintrc.json 파일에서

{
 "extends": "next/core-web-vitals"
 }

여기를

{
 "extends": "next"
 }

이렇게 바꾸고 다시 해봐주시겠어요?
감사합니다.

이은영님의 프로필

이은영

질문자

2022.12.20

감사합니다!