vue.js - 如何解决 vue.js 安装的问题
问题描述
晚上好大家!我正在尝试使用 npm 在我的 linux mint 上安装 vue.js。当我运行 vue 教程中给出的简单命令时:
npm install -g @vue/cli
在一些警告之后,终端中出现以下错误:
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib'
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib']
npm ERR! stack:
npm ERR! 'Error: EACCES: permission denied, access \'/usr/local/lib\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib' }
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! and path to error log here
我明白,“我的操作系统拒绝了该操作”但我不知道如何修复它。如果有人帮我解决这个问题,我将不胜感激,因为我认为问题很简单
解决方案
我在这里的另一个讨论中找到了另一个解决方案 o stackoverflow: npm throws error without sudo
基本上发生的事情是 NPM 没有访问权限/usr/local/lib
。要授予它访问权限,您可以更改所有权~/.npm
以属于您当前的用户。这可能是这样的:
sudo chown -R $(whoami) ~/.npm
这样您就不必以npm
sudo 身份运行,这是不推荐的。我相信这是由于 npm 包中已知的漏洞造成的。
这是一篇关于它的文章:不要在 npm "install" 中使用 "sudo"
推荐阅读
- git - Git不忽略子目录
- docker - 我需要远程连接到我的 docker swarm 以使用 shell 脚本从我的 ci / cd 管道创建服务
- c++ - C++ While 循环无故中断
- arduino - 奇怪的 ESP8266 响应
- tfs - 与 VS 2019 中的最新版本比较
- c# - 使用表达式为方法设置模拟
- r - randomForest **sometimes** predict()s NA on a training dataset
- c# - 如何将我的新图像的路径作为字符串保存到数据库中,以便在创建新记录后我可以看到我选择的图像?
- java - 从底部对齐reclyerview子级
- google-drive-api - 用于创建特定输入列表的自动表