【问题标题】:Missing write access when installing Vue CLI安装 Vue CLI 时缺少写入权限
【发布时间】:2020-04-04 05:43:05
【问题描述】:

由于某种原因,我无法运行 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 相同。我认为没有一些我可以卸载 node在我使用它的任何地方都存在严重问题。卡住了,不知道如何安装或运行 vue cli。

【问题讨论】:

    标签: npm vue-cli


    【解决方案1】:

    我刚刚遇到了同样的问题,但通过在它前面添加“sudo”解决了它。

    所以,新的一行会变成这样;

    sudo npm install -g @vue/cli
    

    【讨论】:

    • 我知道这听起来很愚蠢,我曾在某处读过我不应该使用 SUDO,但对于我的一生,我不记得为什么或在哪里读过它。看起来很明显,我觉得很愚蠢。谢谢@KJParker
    • 我的荣幸!我也读过使用 sudo 是一个坏主意,我不记得为什么,并且有更好的方法解决它,但是,当紧要关头时,它肯定很方便! :D
    猜你喜欢
    • 1970-01-01
    • 2023-03-12
    • 2022-01-15
    • 2021-08-29
    • 2023-03-06
    • 2023-04-04
    • 2013-09-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多