安装之前检查nodejs
如果没安装nodejs按照以下步骤安装$su-$yuminstallopenssl-devel$cd/usr/local/src$wgetprivate-bower-config.json将以下内容粘贴进去:{"port":5678,"registryFile":"./private-bower/bowerRepository.json","disablePublic":false,"publicRegistry":"/packages/","repositoryCache":{"git":{"enabled":true,"cacheDirectory":"./private-bower/gitRepoCache","host":"localhost","port":6789},"svn":{"enabled":true,"cacheDirectory":"./private-bower/svnRepoCache","host":"localhost","port":7891}},"log4js":{"enabled":true,"configPath":"./private-bower/log4js.conf.json"}}$vim/data/private-bower/log4js.conf.json{"appenders":[{"type":"dateFile","filename":"./private-bower/private-bower.log","pattern":"-yyyy-MM-dd","alwaysIncludePattern":false},{"type":"console"}],"replaceConsole":true}启动private-bower$sudosu-$cd/data$private-bower--config./private-bower-config.json[2014-06-3010:00:22.481][INFO]console-[bower]Refreshingpublicpackages[2014-06-3010:00:22.512][INFO]console-[bower]Bowerserverstartedonport5678[2014-06-3010:00:22.538][INFO]console-[bower]Startinggitcacheserver[2014-06-3010:00:22.543][INFO]console-[bower]Startingsvncacheserver[2014-06-3010:01:09.167][INFO]console-[bower]Loadedpublicpackages确保private-bower正常启动:打开一个新窗口来访问:$lynx会显示:ForkmeonGitHubPrivateBower____________________DocsPublicPackagesPrivateBowerserviceisdownNoprivatepackagesregisteredreaddocsabouthowtoregisterpackages.LoadingPackages{{package.name}}hits:{{package.hits}}{{package.repo}}CreatedbyBarnaTothBarnaTóth如果是这样,就安装完毕了客户端测试$sudosu-$npminstall-gbower$su-wlsuser$bowerhelp$vim.bowerrc{"registry":"http://:5678"}$cd$bowerinstalljquery关于bower
简单的来说就是:
包管理软件,用于前端可以用命令行安装js,如同我们用apt-get install软件一样
安装bower
这里依赖于node以及Npm,所以我们需要安装nodejs,具体可以参见nodejs官网,不过如果是同Mac os或者是Ubuntu的话,可以用类似于
brew install npm
再安装bower
npm install -g bower
安装js包
创建一个简单的配置文件.bowerrc用于配置Bower安装路径
{
"directory": "public/"
}
安装
bower install angularjs
$ bower install angularjs
bower cachedgit://github.com/angular/angularjs.org.git#58ef7908d9
bower validate 58ef7908d9 against git://github.com/angular/angularjs.org.git#*
如果要安装指定版本就是(转载保留:bower install js使用bower管理js)
bower install <name>=<package>#<version></version></package></name>
例如
bower install jquery#1.4
评论列表(0条)