& Quot; bower. json contains a syntax error & quot; one of the solutions, bower. json syntax error

Source: Internet
Author: User

"Bower. json syntax error" is one of the solutions.

When you use Visual Studio 2015 Update 3 to open-source projects downloaded from other places, if you find the Bower prompt "syntax error in bower. json ".

Check whether the encoding format of the. bowerrc file is ANSI. If not, use Notepad ++ and other text editor tools to convert the encoding format.

 

The procedure is as follows:

I pulled a project with Web from Github and opened it in Visual Studio 2015 Update 3. I found the Bower prompt "bower. json syntax error ".

Following this error message, it is assumed that the bower. json file under the Web Project has a syntax error.

I opened the file, copied the file content, and found a json online verification (www.bejson.com) on the Internet. No syntax error was found.

As a result, I tried to back up bower. json (PS: Actually rename it ).

Then, compare the backup file and use Bower to re-install the dependency.

When I installed jquery, Bower reported an error:

PATH=.\node_modules\.bin;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External;%PATH%;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\git"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\Bower.cmd" install jquery#2.2.0 --force-latest --saveC:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\node_modules\bower-config\lib\util\rc.js:71        throw error;        ^Error: Unable to parse D:\source\xxx\src\xxx.Web\.bowerrc: Unexpected token     at parse (C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\node_modules\bower-config\lib\util\rc.js:64:21)    at C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\node_modules\bower-config\lib\util\rc.js:97:20    at Array.forEach (native)    at json (C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\node_modules\bower-config\lib\util\rc.js:89:14)    at rc (C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\node_modules\bower-config\lib\util\rc.js:34:13)    at Config.load (C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\node_modules\bower-config\lib\Config.js:16:20)    at readCachedConfig (C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\node_modules\bower\lib\config.js:15:39)    at defaultConfig (C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\node_modules\bower\lib\config.js:11:12)    at Object.<anonymous> (C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\node_modules\bower\lib\index.js:16:32)    at Module._compile (module.js:397:26)

Follow the prompt, FQ Google search a bit, in this http://stackoverflow.com/questions/24534974/emalformed-failed-to-read-bower-json-unexpected-token to find the answer, the general meaning is that the file encoding format is incorrect, converted to the ANSI encoding format is solved.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.