问题描述
我有一些隐藏的字符( )出现在javascript文档的结尾,导致FF或Chrome中的非法字符错误。我看到不同的主题关于这个错误,但没有什么适用于我,我不能看到任何错误在我的文档(显示不可见的字符,用十六进制编辑器打开它)。这只是驱使我疯了。
我使用Vagrant与一个nginx web服务器。该文档在服务器上看起来很清楚(vi +:设置列表)。
I have a few invisible characters (�) that appear at the end of a javascript document that cause the "illegal character" error in FF or Chrome. I saw different topics about this error, but nothing works for me, and i can't see anything wrong in my document (displaying invisible characters, open it with a hexadecimal editor). This is just driving me crazy.I use Vagrant with a nginx web server. The document looks clear in the server too (vi + :set list).
此外,当我从Git存储库中恢复一个清除文档,一切正常。但是每次我要编辑它(如在文档顶部创建一个新变量),我再次遇到此错误。
Plus, when I get back a clear document from my Git repository, everything works(normal). But each time I want to edit it (like create a new variable at the top of document), I got this error again.
如果有人可以帮助我,谢谢。
If someone can helps me, thank you.
推荐答案
看来你正在使用Vagrant ..请看看你的_Vagrantfile并检查文件的写入方式
It seems that you're using Vagrant.. please take a look at your _Vagrantfile and check the way files are written on the VM filesystem.
cat ~/.vagrant.d/boxes/[YOUR VM NAME]/include/_Vagrantfile
也许你正在使用 config.vm.synced_folder
使用NFS:
Maybe you are using config.vm.synced_folder
try to use NFS:
config.vm.synced_folder "/home/myuser/shared", ".", :nfs => true
这篇关于带有vagrant的共享文件夹会导致隐藏字符附加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!