Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

“EMALFORMED Failed to read bower.json” "unexpected token /"

i rather new to mean stack and i'm trying to pull some components using bower.

I have my .bowerrc file which gives the path for installation.

//.bowerrc
 {
    "directory": "public/libs"
 }

and i have my bower.json file which looks like this:

// bower.json
{
    "name": "starter-node-angular",
    "version": "1.0.0",
    "dependencies": {
        "bootstrap": "latest",
        "font-awesome": "latest",
        "animate.css": "latest",
        "angular": "latest",
        "angular-route": "latest"   
    }
}

When i installed bower i had no problem and even the bower search is working perfect. when I'm running the command:

bower install

i get the following message:

Failed to read + path\bower.json

Unexpected token /

i get the same message when I'm trying:

bower install jquery

I tried to change the encoding of file and used json online validation tool.

any ideas??

like image 612
user2656851 Avatar asked Jul 02 '14 15:07

user2656851


2 Answers

Another solution is to open the file in Notepad++, go to "Encoding" and select convert to ANSI.

Best of luck

like image 71
Philippe Matray Avatar answered Oct 17 '22 22:10

Philippe Matray


After creating the .bowerrc file:

  • Open the file in Visual Studio
  • Click on "Save file as" under File menu
  • Click on the down arrow sign on the right side of Save button
  • Select "Save with Encoding"
  • Agree to replace the file
  • Change the Encoding type to "Western European (Windows) - Codepage 1252" and leave the Line endings to "Current Settings"
  • Hit Save button
like image 39
Lina T Avatar answered Oct 17 '22 22:10

Lina T