在使用 Angular6 项目安装 webpack 时出现错误并且无法安装它
我使用 CLI 命令进入名为myNewAngularPro 的项目文件夹-
users-MacBook-Pro-3:myNewAngularPro user$ npm install -g webpack-cli
我得到的错误-:
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm WARN webpack-cli@3.1.0 requires a peer of webpack@^4.x.x 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: '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/user/.npm/_logs/2018-09-04T10_34_48_494Z-debug.log