Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error in a dependency / Syntax error in bower.json

I created a new ASP.NET V5 web project, and added a NPM configuration (package.json) file:

{
    "version": "1.0.0",
    "name": "ASP.NET",
    "private": true,
    "devDependencies": {
        "bower": "1.4.1"
    }
}

Then I added a bower.json file:

{
    "name": "ASP.NET",
    "private": true,
    "dependencies": {
        "bootstrap": "*"
    }
}

I get the following error showing up:

enter image description here


Edit

This happens when I create an empty ASP.NET v5 project. When I create an MVC project, it works fine. I've managed to get the empty project to work when I add in all the client-side related items from the MVC project (e.g. gulpfile.js) so it must have been missing something it needed.

like image 483
Sean Avatar asked Aug 03 '15 08:08

Sean


3 Answers

I had a similar problem and in my case the solution was:

  1. Go to Tools -> Options -> Project and Solutions -> External Web Tools
  2. Uncheck:
    • .\node_modules\.bin
    • $(VSINSTALLDIR)\Web\External
    • $(VSINSTALLDIR)\Web\External\git

Works fine under Visual Studio 2015 Community, however please bear in mind that I do have separately installed and configured both nodejs and git and I don't use any of VS built-in tools.

UPDATE

In Visual Studio 2017 Community the path is:

Tools -> Options -> Project and Solutions -> Web Package Management -> External Web Tools

like image 200
Bartosz Lenar Avatar answered Nov 01 '22 22:11

Bartosz Lenar


Something I did and it worked perfectly was:

  1. Copy all the content (dependencies) of my .bower.json to a notepad (temporary backup)
  2. Delete all dependencies from bower.json
  3. Go to wwwroot/lib and delete manually all the libraries installed (good bye to all the folders there).
  4. Copy the list of my dependencies from my temporary backup (notepad on point 1).
  5. Save the file and wait.
  6. Magically it works fine.
like image 4
fredyfx Avatar answered Nov 02 '22 00:11

fredyfx


I needed to uninstall the bower component from inside the NPM folder.

I had installed it earlier, then removed it from the package.json file, but it was still in the NPM folder. Once removed, it worked fine.

like image 3
Sean Avatar answered Nov 01 '22 22:11

Sean