如何在全球范围内通过npm安装?

时间:2016-08-30 15:03:43

标签: node.js npm

我在OS X(El Capitan)。我使用以下命令安装节点。

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

> 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

出口

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

1 个答案:

答案 0 :(得分:0)

您还需要在本地安装webpack到您的项目中。

npm install webpack --save-dev