npm - 安装 Vue CLI 时缺少写入权限
问题描述
出于某种原因,我无法运行 vue cli 并尝试使用以下命令重新安装:
npm install -g @vue/cli
我得到一串
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/@vue/cli/node_modules/@apollographql/graphql-playground-html
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/@vue/cli/node_modules/@babel/core/node_modules/semver
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/@vue/cli/node_modules/@babel/helper-plugin-utils
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/@vue/cli/node_modules/@babel/parser
然后以
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules/@vue/cli/node_modules/@apollographql/graphql-playground-html
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/@vue/cli/node_modules/@apollographql/graphql-playground-html'
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules/@vue/cli/node_modules/@apollographql/graphql-playground-html'
npm ERR! stack: 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules/@vue/cli/node_modules/@apollographql/graphql-playground-html\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules/@vue/cli/node_modules/@apollographql/graphql-playground-html' }
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.
我尝试更改 /usr/local/lib/node_modules 的权限,然后将组更改为“staff”(这与 /lib 中的 Python 相同。我认为我无法卸载节点而不会在任何地方出现严重问题我用那个。卡住了,不知道如何安装或运行 vue cli。
解决方案
我刚刚遇到了同样的问题,但是通过在它之前添加“sudo”来解决它。
因此,新行看起来像;
sudo npm install -g @vue/cli
推荐阅读
- curl - cURL 不会将 cookie 保存在 k8s cronjob 中
- react-native - 如何使用 PanResponder 移动我的 flatList 的组件?
- c++ - 在带有多个文件的命令行上编译简单的 c++ 程序时遇到困难;也许是链接器错误?
- java - 将 Solr QueryResponse 映射为 Faceting、响应和响应 Header 的 json 格式
- r - R中的Highcharts:在折线图中对xAxis进行排序
- java - 回收站视图使用按钮从图库或相机添加图像
- scala - Protobuf com.esotericsoftware.kryo.KryoException: java.lang.UnsupportedOperationException unknownFields
- postgresql - postgresql:如何添加一个列,该列自动存储带有时间戳的行的创建时间
- twitter-bootstrap - 防止表元素脱离 Bootstrap 列和手风琴部分
- java - 方法reduce(Task, BinaryOperator
) 在流类型中 不适用于参数(HashMap >