Web/그 외
[Linux] npm 특정 버전 설치하기
hjkongkong
2022. 9. 14. 21:38
test로 사용하고 있는 서버와 실제 서버의 npm 버전이 달라서 버전을 맞춰주려고 한다.
버전을 변경할 서버
(base) [hello@localhost /]$ npm --version
8.14.0
npm i -g npm@8.3.2
(base) [hello@localhost /]$ npm i -g npm@8.3.2
npm ERR! code EACCES
npm ERR! syscall rename
npm ERR! path /usr/local/lib/node_modules/npm
npm ERR! dest /usr/local/lib/node_modules/.npm-i9nnxROI
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/npm' -> '/usr/local/lib/node_modules/.npm-i9nnxROI'
npm ERR! [Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/npm' -> '/usr/local/lib/node_modules/.npm-i9nnxROI'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'rename',
npm ERR! path: '/usr/local/lib/node_modules/npm',
npm ERR! dest: '/usr/local/lib/node_modules/.npm-i9nnxROI'
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.
누가봐도 권한 문제...
sudo로 업데이트를 한다.
sudo npm i -g npm@8.3.2
(base) [hello@localhost /]$ npm --version
8.3.2
업데이트 완료^^