Skip to content

run build 맥에서 작용 불가 #8

@Seong-Myeong

Description

@Seong-Myeong

이슈 내용

pnpm 전환 작업 중 pnpm run build 명령어 실행 후

> my-app@0.1.0 build /Users/mingmaengmung/Documents/GitHub/linkiving-extension
> next build && if exist out\_next move out\_next out\next && robocopy ./extensio
n ./out /E                                                                       
sh: -c: line 1: syntax error: unexpected end of file
 ELIFECYCLE  Command failed with exit code 2.

해당 오류를 확인 결과 build시 사용되는 명령어 if문이 맥에서 작용하지 않음

오류 해결 방법

맥 & 윈도우 둘 다 사용가능한 shx 설치

pnpm add -D shx

설치 후 스크립트를 다음과 같이 변경해야함

{
  "scripts": {
    "dev": "next dev --turbopack",
    "build": "next build && pnpm run postbuild",
    "postbuild": "pnpm run move-next && pnpm run copy-ext",
    "move-next": "shx mkdir -p out && (shx test -d out_next && (shx rm -rf out/next; shx mv out_next out/next) || (shx test -d .next && (shx rm -rf out/next; shx mv .next out/next) || shx echo 'skip: no next output'))",
    "copy-ext": "shx mkdir -p out && (shx test -d extension && shx cp -r extension/* out || shx echo 'skip: extension not found')",
    "start": "next start",
    "lint": "eslint ."
  }
}

버그 재현 방법

pnpm run build

npm run build

참고 자료

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions