if this is a new MVC project please check the following as it took mean hours to find the solution.
Sometimes Visual Studio when creating a new MVC Project places the following on the bottom of the _Layout
@RenderSection("scripts", required: false)
Even though i manually declared this above it was causing the same error. Moved both lines to the end of the </head> tag and all is working beautifully.