리액트를 다루는 기술 실습 중 parcel을 이용한 실습 예제를 하다가 parcel 설치가 잘 안되었다
설치까지 다 되었는데 $ parcel index.html
명령어를 쳤을 때 bash: parcel: command not found
에러가 떳다. 해서 환경 변수 문제인것 같아 해당 디렉토리를 추가 했는데도 명령어 가 듣지 않았다.
stackoverflow 에서 해결 방법을 찾았다.
$ npx parcel build index.html
npm ERR! code ENOLOCAL
npm ERR! Could not install from "yoo\AppData\Roaming\npm-cache\_npx\17124" as it does not contain a package.json file.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\minhee yoo\AppData\Roaming\npm-cache\_logs\2022-09-08T02_15_50_167Z-debug.log
Install for [ 'parcel@latest' ] failed with code 1
했더니 parcel@latest 설치 하라고 해서
npm i parcel@latest
설치 후
$ npx parcel build index.html
실행 했지만 dist 파일만 만들어 지고 서버는 실행이 안되었다.
$ parcel -v
bash: parcel: command not found
여전히 parcel 명령어는 실행이 안되고... 다시 stackoverflow를 뒤졌다. 정말 왜인지는 이해 할 수 없지만 나와 같은 문제점인 케이스.
$ yarn add parcel-bundler
다시 parcel을 전역으로 설치 하지 않고
$ yarn add parcel-bundler
설치후
yarn parcel index.html
명령어를 yarn을 넣고 실행 해보니 정상적으로 실행되었다.