linux离线安装bower,linux 下bower安装和使用

一、安装npm

安装node主要是为了使用npm命令,也可以单独安装npm。

安装node可查看如下文章https://blog.csdn.net/huangbaokang/article/details/81092247

二、安装bower

npm install -g bower

三、安装jquery插件

使用bower install jquery命令即可,如果报了如下错,根据提示加上–allow-root参数即可。

[root@localhost hbk]# bower install jquery

bower ESUDO Cannot be run with sudo

Additional error details:

Since bower is a user command, there is no need to execute it with superuser permissions.

If you're having permission errors when using bower without sudo, please spend a few minutes learning more about how your system should work and make any necessary repairs.

http://www.joyent.com/blog/installing-node-and-npm

https://gist.github.com/isaacs/579814

You can however run a command with sudo using "--allow-root" option

如果没有git,可以使用yum install git

安装完之后,在执行命令目录下新建了一个bower_components目录,里面下载用到的插件。

更新插件

bower update jquery --allow-root

卸载插件

bower uninstall jquery

修改默认的文件夹bower_components,建立一个.bowerrc文件

配置成如下:

{

"directory" : "js/huangbaokang",

"json" : "",

"endpoint" : "",

"searchpath" : "",

"shorthand_resolver" : ""

}

再次执行,可以看到存储到了我们自定义的目录了。

[root@localhost hbk]# bower install jquery --allow-root

bower cached https://github.com/jquery/jquery-dist.git#3.3.1

bower validate 3.3.1 against https://github.com/jquery/jquery-dist.git#*

bower install jquery#3.3.1

jquery#3.3.1 js/huangbaokang/jquery

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值