2016-08-30 276 views
0

我在OS X(El Capitan)上。我使用以下命令安裝節點。如何通過全局安裝npm?

brew install node

然後我用下面的命令安裝的WebPack:

npm install -g webpack

而且我也關注了此網址:Github Url 要全局安裝,但是當我運行我的終端,我就 webpack獲得

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 

> [email protected] 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 

出口

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 
+0

安裝成功嗎?你需要用'sudo'運行它 – Vasan

+0

當你安裝webpack的時候輸出是什麼 - 我敢打賭它失敗了? – Alex

+0

不,它表示安裝成功 –

回答

0

你需要的WebPack本地安裝到你的項目也是如此。

npm install webpack --save-dev