Rahul Shrivastava Rahul Shrivastava - 3 months ago 15
Node.js Question

How to install through npm globally?

I am on OS X(El Capitan). I install node using following command.

brew install node


Then I installed webpack using following command:

npm install -g webpack


And I also followed this url : Github Url
To install globally but when I am running
webpack
on my terminal I am getting

zsh: command not found: webpack


~/projects/personal/React  npm install -g webpack
/Users/rahul/.npm-packages/bin/webpack -> /Users/rahul/.npm-packages/lib/node_modules/webpack/bin/webpack.js

> fsevents@1.0.14 install /Users/rahul/.npm-packages/lib/node_modules/webpack/node_modules/fsevents
> node-pre-gyp install --fallback-to-build

[fsevents] Success: "/Users/rahul/.npm-packages/lib/node_modules/webpack/node_modules/fsevents/lib/binding/Release/node-v48-darwin-x64/fse.node" is installed via remote
/Users/rahul/.npm-packages/lib


export

Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.Tp9FugZTE3/Render
DISPLAY=/private/tmp/com.apple.launchd.ZgQngbBnwx/org.macosforge.xquartz:0
EDITOR='subl -w'
HOME=/Users/rahul
ITERM_PROFILE=Custom
ITERM_SESSION_ID=w0t4p1:4DEA1B55-94CE-48E7-85A6-347D29A53122
ITERM_SHELL_INTEGRATION_INSTALLED=Yes
LC_CTYPE=UTF-8
LESS=-R
LOGNAME=rahul
LSCOLORS=Gxfxcxdxbxegedabagacad
PAGER=less
PATH=/usr/local/share/python:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
PROJECT_HOME=/Users/rahul/Projects
PWD=/Users/rahul/projects/personal/React
SHELL=/bin/zsh
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.Ixik08zS9V/Listeners
TERM=xterm-256color
TERM_PROGRAM=iTerm.app
TERM_PROGRAM_VERSION=3.0.7
TERM_SESSION_ID=w0t4p1:4DEA1B55-94CE-48E7-85A6-347D29A53122
TMPDIR=/var/folders/kk/9jwxx0r532s_cff8m4rx080w0000gn/T/
USER=rahul
USER_NAME=Rahul
VIRTUALENVWRAPPER_HOOK_DIR=/Users/rahul/.virtualenvs
VIRTUALENVWRAPPER_PROJECT_FILENAME=.project
VIRTUALENVWRAPPER_SCRIPT=/usr/local/bin/virtualenvwrapper.sh
VIRTUALENVWRAPPER_WORKON_CD=1
WORKON_HOME=/Users/rahul/.virtualenvs
XPC_FLAGS=0x0
XPC_SERVICE_NAME=0
ZSH=/Users/rahul/.oh-my-zsh
__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0

Answer

you need to install webpack locally into your project as well.

npm install webpack --save-dev