昨天发现的nginx默认不支持下划线引起angular-phonecat项目部分文件404问题

今天发现原来确实是不存在这个文件。。。

因为我的Ubuntu的git没有安装,所以导致bower install时没有拉下来依赖包,因为bower是使用的git拉的包。

但是同时也搜到了nginx不支持下划线的问题,也算小有收获

 

于是下面就是git安装。。。

sudo apt-get update
sudo apt-get install git

即可

git config --global user.name "Your Name"
git config --global user.email "youremail@domain.com"

配置账号密码

  git checkout tag|master

  git add filename

  git commit

  git checkout -- filename

即可

 

发现还不能即可,安装完git后还会报

npm WARN cannot run in wd angular-phonecat@0.0.0 bower install (wd=/home/angular-phonecat-master)

搜索之,官方说明https://www.npmjs.com/package/unix-access

需要一个npm install unix-access模块来控制权限

 

结果装完之后依然报错,只能强行安装了

npm install --unsafe-perm

使用不安全模式安装,结果还报错,好的是报错信息变了。。。

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

 

好兆头,说的是没必要用sudo执行bower,可是我只有root用户啊。。。按他说的,使用--allow-root选项强行使用root账户安装试试

(修改package.json,在bower install后面加参数--allow-root)

终于成功了,真不容易,估计最开始的问题就是这个。

 

使用nginx代理启动成功,至于去掉下划线能否成功访问,这个我就不实验了。。。

 

手贱试了一下,果然成功了,因为昨天在日志里看到有取下划线文件夹中文件的请求,所以应该是请求头的名字不能包含下划线,值是可以包含下划线的

但是在http标准中,不推荐使用下划线,用横杠代替

posted @ 2015-10-03 10:43  光闪  阅读(960)  评论(0编辑  收藏  举报