javascript/Vue.js
[Vue.js] mac 상에서 npm 이용시 Error - 권한설정 문제로 해결하자.
http://portfolio.wonpaper.net
2023. 8. 21. 16:12
폴더권한 문제 때문에 발생한다.
sudo 명령어를 앞에 sudo npm ~~ 이런식으로 붙여서 설치하면 대부분 해결된다.
이는 일시적인 해결법이다.
아래 log 내용을 보면 친절하게 설명해놓았다.
영구적인 해결방법으로 (필자의 폴더경로상황)
sudo chown -R 501:20 "/Users/jongwon/.npm"
아래에 필자의 log 정보를 남겨놓았다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
jongwon@ijong-won-ui-MacBookPro ~ % cd vue_study
jongwon@ijong-won-ui-MacBookPro vue_study % vue create vue_test1
Vue CLI v5.0.8
? Please pick a preset: Default ([Vue 3] babel, eslint)
Vue CLI v5.0.8
✨ Creating project in /Users/jongwon/vue_study/vue_test1.
🗃 Initializing git repository...
⚙️ Installing CLI plugins. This might take a while...
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /Users/jongwon/.npm/_cacache/index-v5/39/40
npm ERR! errno EACCES
npm ERR!
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR!
npm ERR! To permanently fix this problem, please run:
npm ERR! sudo chown -R 501:20 "/Users/jongwon/.npm"
npm ERR! A complete log of this run can be found in: /Users/jongwon/.npm/_logs/2023-08-21T06_46_22_467Z-debug-0.log
ERROR Error: command failed: npm install --loglevel error --legacy-peer-deps
Error: command failed: npm install --loglevel error --legacy-peer-deps
at ChildProcess.<anonymous> (/usr/local/lib/node_modules/@vue/cli/lib/util/executeCommand.js:138:16)
at ChildProcess.emit (node:events:514:28)
at maybeClose (node:internal/child_process:1091:16)
at ChildProcess._handle.onexit (node:internal/child_process:302:5)
jongwon@ijong-won-ui-MacBookPro vue_study %
jongwon@ijong-won-ui-MacBookPro vue_study % sudo chown -R 501:20 "/Users/jongwon/.npm"
Password:
jongwon@ijong-won-ui-MacBookPro vue_study %
Vue CLI v5.0.8
? Target directory /Users/jongwon/vue_study/vue_test1 already exists. Pick an action: Overwrite
Removing /Users/jongwon/vue_study/vue_test1...
Vue CLI v5.0.8
? Please pick a preset: Default ([Vue 3] babel, eslint)
Vue CLI v5.0.8
✨ Creating project in /Users/jongwon/vue_study/vue_test1.
🗃 Initializing git repository...
⚙️ Installing CLI plugins. This might take a while...
added 862 packages, and audited 863 packages in 19s
94 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
🚀 Invoking generators...
📦 Installing additional dependencies...
added 101 packages, and audited 964 packages in 4s
107 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
⚓ Running completion hooks...
📄 Generating README.md...
🎉 Successfully created project vue_test1.
👉 Get started with the following commands:
$ cd vue_test1
$ npm run serve
|
cs |
참고 : https://codingapple.com/unit/vue-3-installation-with-vue-cli/