首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Vue-Cli不会安装

Vue-Cli不会安装
EN

Stack Overflow用户
提问于 2018-11-25 18:53:29
回答 2查看 5.1K关注 0票数 2

我有节点11.2.0

继续收到这个错误。

代码语言:javascript
复制
Andrews-MacBook-Pro:vueTutorial aharris$ npm install -g @vue/cli
npm WARN deprecated hoek@5.0.4: This version is no longer maintained. Please upgrade to the latest version.
npm WARN deprecated cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm WARN @apollographql/apollo-upload-server@5.0.3 requires a peer of graphql@^0.13.1 but none is installed. You must install peer dependencies yourself.

npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR!  { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules']
npm ERR!   stack:
npm ERR!    "Error: EACCES: permission denied, access '/usr/local/lib/node_modules'",
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules' }
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 (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/aharris/.npm/_logs/2018-11-25T18_43_42_502Z-debug.log
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2018-11-25 19:02:38

您正面临文件权限问题。

-g参数npm的意思是“全局”,它将将这些文件安装在系统目录中,特别是在您的计算机/usr/local/lib/node_modules中,其中所有者可能是root,并具有rwxr-xr-x权限,这意味着那些不是root的人将没有写入的权限。

然后,您可以使用sudo获得该权限,或者像NPM modules won't install globally without sudo所说的那样,将npm前缀设置到您拥有权限的路径中:

代码语言:javascript
复制
$ npm config set prefix '~/.npm-packages'
票数 5
EN

Stack Overflow用户

发布于 2019-01-05 16:41:42

你所需要做的就是在它之前用sudo运行相同的命令,

代码语言:javascript
复制
sudo npm install -g @vue/cli

系统会提示您输入管理密码。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53470784

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档