And*_*rew 2 node.js npm vue.js vue-cli vue-cli-3
我有节点 11.2.0
继续收到此错误。
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
Run Code Online (Sandbox Code Playgroud)
您正面临文件权限问题。
-g参数的npm意思是“全局”,它会将这些文件安装在系统目录中,特别是在您的计算机中/usr/local/lib/node_modules,所有者可能root并且有权限rwxr-xr-x,意味着那些root没有权限的人将没有写入权限。
然后,您可以使用sudo获取此权限,或者就像NPM 模块不会在没有 sudo说的情况下全局安装一样,将 npm 前缀设置为您拥有权限的路径:
$ npm config set prefix '~/.npm-packages'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4364 次 |
| 最近记录: |