Trying to install Jquery and Underscore using Bower - bower

I am currently going through a tutorial on Pluralsite on how to build a web app. The instructor wants me to install 'underscore' and 'jquery' using 'Bower'. I added bower and edited the bower.json file to add underscore and jquery however both have failed to install and I am not sure why.
I also added them via nuget and that works however I am not sure how to reference the nuget packages in my index.html file. Everything I have read seems to indicate that bower is the better option but at this point getting it to work either way would make me happy.

Without any real detail in your post you can check the following but this may differ a bit. But it's not clear if you actually see an error or whether you just can't see the files?
In Visual Studio 2015 if you open the .xproj file using a text editor you should see the following entries:
<ItemGroup>
<DnxInvisibleContent Include="bower.json" />
<DnxInvisibleContent Include=".bowerrc" />
</ItemGroup>
If you're using VS 2017 then Right Click your Project and click "Edit .csproj" and if you see anything similar to below your bower file is in the wrong location for the default setup:
<ItemGroup>
<Content Include="wwwroot\.bowerrc" />
<Content Include="wwwroot\bower.json" />
</ItemGroup>
Your bower.json should look like this:
{
"name": "asp.net",
"private": true,
"dependencies": {
"underscore": "~1.8.3"
,"jQuery": "~3.2.1"
}
}
When you save the bower.json file it will automatically get the packages.
It sounds to me like you already know this though and the actual getting of the package is failing. Do you know this because there is an error message or because you can't see the files? If you can't see the files check the wwwroot folder for a lib folder or another wwwroot folder and a lib folder within that.
If you have added the bower configuration file to a different location to the base of the project you may end up with the files in a wwwroot folder and the lib folder inside that from where your config file resides.
To use this file in your HTML you add a script tag or find the file in your Solution Explorer window and drag it into your HTML file when it is open and Visual Studio will automatically create the correct script tag and location for the file:
<script type="text/javascript" src="lib/jquery/dist/jquery.min.js></script>
If you look at jQuery in "Manage NuGet Packages" you should see it says "Incompatible: Use Bower instead". But that doesn't stop you from getting it using NuGet and you can locate the files in "$(UserProfile).nuget\packages\" which should mean "C:\Users\.nuget\packages\jquery\3.1.1\Content\Scripts\jquery-3.1.1.min.js" is what you would need to include on your HTML page but browsers tend to block links to the file system now so you would probably be better off using:
<script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>
That doesn't resolve your issue because that file could be removed from the host and then your link would fail and therefore it's best to fix the root of the problem but you may need to add a bit more detail to your post to get a clear answer I think but the above may help a bit.

Do you have Git installed for windows?
Try installing Git and then restart visual studio.
I ran into this problem when updating from VS2015 to VS2017.
You should see a folder called 'lib' after you've installed underscore.js.
Hope this helps!

Not sure if you are still having issues with this but it looks like this was a bug in Visual Studio 2017. I was having this same issue on the same tutorial.
Microsoft has since fixed it with their latest release of Visual Studio 2017 (15.3).
Update to the current version and then re-add the packages using bower and it should work correctly.

The bug has returned in VS 2019. Trying to install via NuGet the Jquery packages and I get the Incompatible. Use Bower instead.

Related

How do I get F# Forge to work

I can't seem to get Forge to work.
I'm using VS Code 1.6.1 with Ionide-F# 2.8.2. Until now I've only compiled scripts, but I need a project file for a specfic .dll to work (Unmanaged Exports).
However I can't seem to get an F# project going with Forge. When I use the `>F# New Project" command it tells me I need to refresh my templates, because I don't have any.
If I refresh, nothing happens. I have git installed as was suggested in other places, but to no avail.
When I open Forge.exe directly from my C:\Users\>USER<\.vscode\bin-forge directory, it doesn't even go into interactive mode. I downloaded Forge separately with the same result.
Has anyone else encountered this issue?
I'm not sure why it's working now, the only thing I can remember doing is adding the following to my user settings:
"FSharp.toolsDirPath": "C:/Program Files (x86)/Microsoft SDKs/F#/4.0/Framework/v4.0",
"FSharp.fsiFilePath": "C:/Program Files (x86)/Microsoft SDKs/F#/4.0/Framework/v4.0/Fsi.exe"
Maybe Forge didn't find the F# tools, but they're on the windows path, so I can't fathom why it helped.

How can I use a bower component in Dart?

I have found a nice JS component that's installed with Bower.
I'd like to know how I could import my component and let it be served by Pub.
So far I've tried to bower install it, and it gets downloaded in the root of my project in /bower_components
And then in my index.html I tried:
<link rel="import" href="../bower_components/paper-date-picker/paper-date-picker.html">
but Pub won't load the files (seems like it can't figure out relative paths in Bower).
By default, pub serves web as root folder, so you cant go deeper than root.
The easiest way to get this to work is to symlink bower_components folder into web folder, like pub does for packages folder.
Don't forget to remove .. before /bower_components in your href attribute after that.
Your path looks right ../ this is correct but go to /bower_components/paper-date-picker/paper-date-picker.html and make sure it is right.
or change that line to
../bower_components/paper-date-picker/paper-date-picker-dialog.html
and see if it works.

Change grails linked resources path in GGTS

I am using Grails 2.3.2 with GGTS and am doing development on two different machines (Mac and Windows). Each time I commit my project from one machine and update the other I have to refresh my dependencies. Is there a way I can set this to some sort of relative path? That way it doesn't have to change each time I do an update from my repository.
It seems that a full path is being included in my .project file as shown below.
<linkedResources>
<link>
<name>.link_to_grails_plugins</name>
<type>2</type>
<location>C:/Users/michael/workspace/myproject/target/work/plugins</location>
</link>
</linkedResources>
I changed it manually in the file, but GGTS seemed to change it back when I did the refresh. Has anyone else run into this problem?
After some looking around it looks like I can specify a path relative to my workspace using the WORKSPACE_LOC and building up a path relative to that within my .project file.
<linkedResources>
<link>
<name>.link_to_grails_plugins</name>
<type>2</type>
<location>WORKSPACE_LOC/myproject/target/work/plugins
</location>
</link>
</linkedResources>
The better is to not commit files generated by the GGTS and that are S.O. dependent.
If you're using git, there's a command to generate the file:
grails integrate-with --eclipse
If not, you can see the git file and ignore those files in the SVN.

Umbraco - Install packages

I'm new to Umbraco and I'm try to install some packages from the Umbraco package Repository. I'm getting a 500 - Internal server error in the Umbraco CMS when trying to browse the packages. First I thought I did something wrong in my installation of Umbraco but when I look at the source code it looks like packages.umbraco.org are having problems. Can anyone confirm if they having the same problem?
Thanks
Download the packages from our.umbraco.org and install as a local package. If that doesn't work then it may be permissions. If you aren't able to download packages on our.umbraco.org, then the package server may be down.
First of all either check the logs or change the customErrors section of your web.config so that you can see more details on the error.
<customErrors mode="Off" />
I have on a few rare occasions installed a version of Umbraco where I think the installedPackages.config file was empty and without at least an empty <packages /> node it generates an error. Check the file looks like this as a minimum:
<?xml version="1.0" encoding="utf-8"?>
<packages />
You will usually find the file located in App_Data\packages\installed\installedPackages.config however I think this may have changed in more recent versions of Umbraco.
Some good tips already, so I'll add a less likely one!
I have seen this error when I've first installed and for some reason the .net worker process has crashed so the internal error is simply that the site can't find cassini (or IIS depending on your settings).
Or perhaps there is nothing wrong and it is in fact related to the current issue with the Umbraco servers:
ICYMI: Our ISP have issues with their virtualisation platform and it affects > http://umbraco.com , umbraco.tv, Our Umbraco and package repo.
https://twitter.com/umbraco/statuses/293297374271533056

Any way to get Intellij IDEA to add *GrailsPlugin.groovy to class path?

When managing a grails plugin in Intellij Idea (I'm using version 10.5.2 on OSX, if it matters), I can't get it to add the *GrailsPlugin.groovy file to the classpath in a way that it can be recognized by unit tests run from the IDE. The tests run fine from the command line using grails test-app; I just want IDEA to be able to run them too.
The problem is that the *GrailsPlugin.groovy file is at the top level directory in the plugin, which is not marked as a source directory in IDEA. I definitely don't want to make it a source folder, since that will screw up lots of things such as the package path to all of my regular source files (amongst many other issues).
I've tried adding *GrailsPlugin.groovy to my Settings->Compiler Resource Patterns, but to no avail. Since the file isn't in a source folder, it's ignored.
I tried creating a source folder that has a symlink to the *GrailsPlugin.groovy file, but that introduces all kinds of synchronization issues.
Anyone have any ideas?

Resources