Windows环境下的NodeJS+NPM+Bower安装配置步骤
首先确定安装了nodejs;
其中,npm作为一个nodejs的模块管理,之前由于没有系统地看资料所有导致安装配置模块的时候走了一大段弯路,所有现在有必要列出来记录下,我们要先配置npm的全局模块的存放路径以及cache的路径,例如我希望将以上两个文件放在nodejs的主目录下,便在nodejs下建立“node_global”和“node_cache”两个文件夹,我们就在cmd中键入两行命令:
npm config set prefix "C:\Program Files (x86)\nodejs\node_global"
和
npm config set cache "C:\Program Files (x86)\nodejs\node_cache"
请大家注意,因为我事先降NodeJS安装在了“C:\Program Files (x86)\nodejs”目录下,所以大家键入命令时请正确输入你们的NodeJS目录。
上段步骤可查看:
http://www.kankanews.com/ICkengine/archives/130130.shtml Windows环境下的NodeJS+NPM+Bower安装配置步骤
第二:bower解决js的依赖管理 http://blog.fens.me/nodejs-bower-intro/
运行bower安装JS出现问题的时候,例如:
Bower : ENOGIT git is not installed or not in the PATH
当我在cmd窗口中用下边命令时:
1)windows环境
d:\myproject> bower install bootstrap-sass
出现 Bower : ENOGIT git is not installed or not in the PATH错误,则需要配置你的Git到path,具体如下
方法一:假如你的git安装目录是”C:\Program Files (x86)\Git”,在path中( 系统属性中)加入git的bin和cmd目录,如C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Git\cmd
C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;D:\Program Files\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\nodejs\;D:\Program Files\TortoiseGit\bin;D:\Program Files\Git\bin;D:\Program Files\Git\cmd
方法二:使用Git Bash来代替cmd
备注: 如果方法一不起作用是因为,你修改的path没有生效, 你需要重新启动电脑
2)Ubuntu:
安装git:
$ apt-get install git