This error occurs if you don't have SQL Express installed, or not running, or Entity Framework has some other difficulty connecting to SQL Express, for example failure to login. Look at the inner exception to see the actual SQL Exception that should tell you what is going on.
With Code-First, Entity Framework needs to connect to the database server at build time to generate the metadata for the mapping.
The Javascript error is most likely the result of the first error, you don't have properly built assemblies.