인프런 커뮤니티 질문&답변
aws 에서 front 빌드 시 에러가 뜨는데 해매고 있습니다..
작성
·
828
0
Error: Parsing error: Must use import to load ES Module: /home/ubuntu/new-node-bird-std/front/node_modules/eslint-scope/lib/definition.js
require() of ES modules is not supported.
require() of /home/ubuntu/new-node-bird-std/front/node_modules/eslint-scope/lib/definition.js from /home/ubuntu/new-node-bird-std/front/node_modules/babel-eslint/lib/require-from-eslint.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename definition.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /home/ubuntu/new-node-bird-std/front/node_modules/eslint-scope/package.json.
info - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-nodebird-front@1.0.0 build: `cross-env ANALYZE=true NODE_ENV=production next build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-nodebird-front@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/ubuntu/.npm/_logs/2022-03-04T00_05_27_105Z-debug.log
AWS 에서 front 쪽 빌드 시 위의 에러가 발생하는데
로컬에선 빌드가 되서 .next gitignore 풀고 github에 올리려 하니 용량 문제가 있는지 그마저도 업로드가 안됩니다.
퀴즈
EC2 인스턴스에 배포된 서버에서 GitHub의 최신 소스 코드를 받아오기 위해 주로 사용하는 Git 명령어는 무엇일까요?
git push
git add
git commit
git pull
답변 2
0
0
제로초님, 제가 nvm으로 노드를 설치하여 node 버전 및 nvm install-latest-install로 npm 버전을 저의 로컬 npm 버전과 맞춰준 다음
린트 rules 에
를 추가 하고 나니, 빌드가 되긴 됩니다..! 둘중에 어떤게 원인 인지는 모르겠어서 둘다 적용해 놓으니 되네요; 하나씩 빼보면서 테스트 해보겠습니다;
일단 npm 버전 차이가 가장 의심 스럽긴 한거 같아요..





혹시 제 로컬의 node -v는
14.17.0 & npm -v 8.3.0 이고
우분투에 설치된 node -v는
14.19.0 & npm -v 6.14.16 인데 여기서 영향이 있을 수도 있나요..?
(eslintrc 랑 package.json는 아래의 댓글에 적어놨습니다~!)