2017-08-28 37 views
0

我註冊了.bowerrc。 .bowerrc是爲什麼在.bowerrc中發生語法錯誤?

{ 
    "directory": "bower_components", 
    "timeout": 120000, 
    "registry": { 
    "search": 
     "https://github.com", 
    } 
} 

但是當我運行源.bowerrc,錯誤發生和回溯說

-bash: directory:: command not found 
-bash: timeout:: command not found 
-bash: registry:: command not found 
-bash: search:: command not found 
-bash: https://github.com,: No such file or directory 
-bash: .bowerrc: line 8: syntax error near unexpected token `}' 
-bash: .bowerrc: line 8: `}' 

我真的不明白爲什麼語法錯誤happens.Is有什麼問題嗎?我怎樣才能解決這個問題?

回答

0

您無需輸入.bowerrc才能應用包含的配置,bower在調用behind the scenes時完全適合您。

您看到的錯誤是bash試圖將JSON格式的文本文件作爲shell腳本執行(這就是源文件時發生的情況)。運營商{}group commands in the same shell contextbash正試圖執行directory: bower_components,和此後的每一行,這是不是有效的命令/可執行文件/ shell函數。