-
최근에 노트북을 맥북으로 구입했는데 윈도우에서는 겪은 적 없던 오류를 기록해보려고 한다.
1. 맥북에서 npm i -g ~를 했을 때, 권한 에러가 뜨는 경우
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead. npm ERR! code EACCES npm ERR! syscall symlink npm ERR! path ../lib/node_modules/yarn/bin/yarn.js npm ERR! dest /usr/local/bin/yarn npm ERR! errno -13 npm ERR! Error: EACCES: permission denied, symlink '../lib/node_modules/yarn/bin/yarn.js' -> '/usr/local/bin/yarn' npm ERR! [Error: EACCES: permission denied, symlink '../lib/node_modules/yarn/bin/yarn.js' -> '/usr/local/bin/yarn'] { npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'symlink', npm ERR! path: '../lib/node_modules/yarn/bin/yarn.js', npm ERR! dest: '/usr/local/bin/yarn' npm ERR! } npm ERR! npm ERR! The operation was rejected by your operating system. npm ERR! It is likely you do not have the permissions to access this file as the current user npm ERR! npm ERR! If you believe this might be a permissions issue, please double-check the npm ERR! permissions of the file and its containing directories, or try running npm ERR! the command again as root/Administrator. npm ERR! A complete log of this run can be found in: npm ERR! /Users/yeseulkim/.npm/_logs/2022-08-08T09_24_33_788Z-debug-0.log
- 에러를 읽어보면 알겠지만 접근할 수 있는 권한이 없다고 나온다.
- 권한을 나에게 주면 된다.
sudo chown -R $(whoami) ~/.npm sudo chown -R $(whoami) /usr/local/lib/node_modules
- 여기서 sudo 커맨드는 권한이 없는 사용자에게 관리자 권한이 필요한 명령어를 터미널 내에서 수행할 수 있도록 도와주는 커맨드이다. (sudo = superUser = 수퍼관리자)
- chown : 파일의 소유권
- whoami는 유저이름을 알려준다.
- 이를 통해, npm 과 node_modules에 관리자 권한을 추가해주는 것이다.
출처 :
install npm packages without sudo
2. 터미널에서 패스워드가 입력이 되지 않을 때
- 이거는 찾아보니 답변이 어이 없었는데 암호를 보호하기 위해 맥북에서는 비밀번호 표시가 나타나지 않는다. 그래서 그냥 입력하고 엔터치면 된다.
출처 :
Update : 2022. 10. 01
2. vite 사용 시 yarn과 호환이 되지 않는 경우
- 이거는 사실 mac의 문제인지는 모르겠는데, 윈도우에서는 한번도 겪어보지 않아서 이곳에 작성한다.
- yarn set version stable 하면된다. 아마 둘이 호환이 되지 않아 생기는 문제 같다.
출처 :
https://stackoverflow.com/questions/72889805/yarn-3-1-vite-2-9-cannot-find-package-vite
계속 추가 예정 🏃♀️🏃♀️🏃♀️
'Error' 카테고리의 다른 글
vite: alias 설정이 되지 않을 때 (0) 2023.01.10 vite : 라이브러리 다운로드 후 504 에러가 뜰 때 (0) 2023.01.10 yarn : Could not resolve dependency... (0) 2022.04.11 Unexpected token u in JSON at position 0 Error in JS (0) 2022.04.06 리액트 타입스크립트 에러 : IntrinsicAttributes 오류에 대하여 (0) 2022.03.24 댓글