MacBook-Air:~ xxx$ npm install webpack -g
npm WARN invalid config registry=""
npm WARN invalid config Must be a full url with 'http://'
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/acorn-dynamic-import
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/ajv
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/brorand
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/error-ex
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/for-in
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/for-own
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/fsevents/node_modules/abbrev
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/fsevents/node_modules/ansi-regex
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/fsevents/node_modules/aproba
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/fsevents/node_modules/aws4
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/fsevents/node_modules/bcrypt-pbkdf
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/fsevents/node_modules/chalk/node_modules/supports-color
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/fsevents/node_modules/jsbn
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/fsevents/node_modules/mime-db
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/fsevents/node_modules/mime-types
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/fsevents/node_modules/object-assign
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/fsevents/node_modules/gauge
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/fsevents/node_modules/qs
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/fsevents/node_modules/sshpk
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/fsevents/node_modules/strip-json-comments
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/fsevents/node_modules/rc
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/fsevents/node_modules/node-pre-gyp
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/fsevents
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/fsevents/node_modules/supports-color
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/hosted-git-info
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/is-buffer
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/loader-utils
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/elliptic
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/normalize-package-data
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/parse-asn1
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/readable-stream
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/uglify-js/node_modules/async
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/uglify-js
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/watchpack
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/fsevents/node_modules
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/fsevents/node_modules/chalk/node_modules
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/webpack/node_modules/uglify-js/node_modules
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
- supports-color@2.0.0 node_modules/webpack/node_modules/fsevents/node_modules/chalk/node_modules/supports-color
- async@0.2.10 node_modules/webpack/node_modules/uglify-js/node_modules/async
/usr/local/lib
└─┬ webpack@2.2.1
├── acorn-dynamic-import@2.0.2
├── ajv@4.11.5
├── loader-utils@0.2.17
├─┬ memory-fs@0.4.1
│ └── readable-stream@2.2.6
├─┬ node-libs-browser@2.0.0
│ └─┬ crypto-browserify@3.11.0
│ └─┬ browserify-sign@4.0.0
│ ├─┬ elliptic@6.4.0
│ │ ├── brorand@1.1.0
│ │ ├── hmac-drbg@1.0.0
│ │ └── minimalistic-crypto-utils@1.0.1
│ └── parse-asn1@5.1.0
├── uglify-js@2.8.14
├─┬ watchpack@1.3.1
│ └─┬ chokidar@1.6.1
│ ├─┬ anymatch@1.3.0
│ │ └─┬ micromatch@2.3.11
│ │ ├─┬ kind-of@3.1.0
npm ERR! Darwin 15.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "webpack" "-g"
npm ERR! node v6.2.0
npm ERR! npm v3.8.9
npm ERR! path /usr/local/lib/node_modules/webpack/node_modules/acorn-dynamic-import
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/webpack/node_modules/acorn-dynamic-import'
npm ERR! at Error (native)
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules/webpack/node_modules/acorn-dynamic-import'
npm ERR! at Error (native)
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules/webpack/node_modules/acorn-dynamic-import' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
40mis-buffer@1.1.5
│ │ └─┬ object.omit@2.0.1
│ │ └─┬ for-own@0.1.5
│ │ └── for-in@1.0.2
│ └─┬ fsevents@1.1.1
│ └─┬ node-pre-gyp@0.6.33
│ ├─┬ nopt@3.0.6
│ │ └── abbrev@1.1.0
│ ├─┬ npmlog@4.0.2
│ │ └─┬ gauge@2.7.3
│ │ ├── aproba@1.1.1
│ │ ├── object-assign@4.1.1
│ │ └─┬ strip-ansi@3.0.1
│ │ └── ansi-regex@2.1.1
│ ├─┬ rc@1.1.7
│ │ └── strip-json-comments@2.0.1
│ └─┬ request@2.79.0
│ ├── aws4@1.6.0
│ ├─┬ har-validator@2.0.6
│ │ └─┬ chalk@1.1.3
│ │ └── supports-color@2.0.0
│ ├─┬ http-signature@1.1.1
│ │ └─┬ sshpk@1.10.2
│ │ ├── bcrypt-pbkdf@1.0.1
│ │ └── jsbn@0.1.1
│ ├─┬ mime-types@2.1.14
│ │ └── mime-db@1.26.0
│ └── qs@6.3.1
├── webpack-sources@0.1.5
└─┬ yargs@6.6.0
└─┬ read-pkg-up@1.0.1
└─┬ read-pkg@1.1.0
├─┬ load-json-file@1.1.0
│ └─┬ parse-json@2.2.0
│ └── error-ex@1.3.1
└─┬ normalize-package-data@2.3.6
└── hosted-git-info@2.3.1
npm ERR! Please include the following file with any support request:
npm ERR! /Users/xxx/npm-debug.log
解决办法就用这一条命令 : sudo npm install webpack -g 成功在全局安装了webpack;