npm ERR! code EACCES npm ERR! syscall open npm ERR! path /Users/wangning/.npm/_cacache/index-v5/4f/db/12a8c21ce52221ad40630119090719365f5a66330a3a7382025283fe4d22 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/wangning/.npm" npm ERR! A complete log of this run can be found in: npm ERR! /Users/wangning/.npm/_logs/2023-06-03T02_34_59_741Z-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:513:28) at maybeClose (node:internal/child_process:1091:16) at ChildProcess._handle.onexit (node:internal/child_process:302:5)
时间: 2024-01-27 08:04:35 浏览: 268
npm install ERR
这个错误提示看起来是你在使用npm安装依赖时出现了权限问题,因为你的缓存文件夹中包含了根用户所有的文件。解决这个问题的方法是运行sudo chown -R 501:20 "/Users/wangning/.npm" 命令,将文件夹的所有者更改为你自己的用户。另外,你还可以通过使用npx或者yarn来代替npm来安装依赖,这两个工具也可以完成npm的功能。
阅读全文