我在win10上安装到了node.js、git
并且也配置了环境变量
在cmd下npm等命令都生效
npm config ls
; cli configs
user-agent = "npm/2.15.9 node/v4.6.1 win32 x64"
cache = "F:\\software\\NodeJS\\node_cache"
prefix = "F:\\software\\NodeJS\\node_global"
也安装了bower,是全局安装 -g
bower help
Usage:
bower <command> [<args>] [<options>]
Commands:
cache Manage bower cache
help Display help information about Bower
home Opens a package homepage into your favorite browser
info Info of a particular package
init Interactively create a bower.json file
但是再用git bash使用bower的时候发现找不到模块,奇怪的是git查找的路径是git安装目录,并不是设置的prefix = "F:\software\NodeJS\node_global"
$ bower help
module.js:327
throw err;
^
Error: Cannot find module 'F:\software\Git\Git\node_modules\bower\bin\bower'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
at node.js:974:3
如何才能让cmd和git bash统一环境变量?
再在 git-bash 里面 npm config set prefix 一遍。