Full error:

Cannot make a cache safe URL for "sprocketcomplete/layouts/sprocketcomplete/js/sprocketcomplete.js", file not found. Please verify that the file exists under the layouts directory.

I have added a Mapped Folder for Layouts. My JS files are set to Build Action: Content and Copy to Output Directory: Copy always.

I also set Localizable on my ScriptLink tag to false

Has anyone seen this error before? Is there something I should be doing to make this work?


This is a webfarm solution, not a sandbox solution.

On my file system the js files are located at:

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\SprocketComplete\js\

Here is my ScriptLink tags:

<SharePoint:ScriptLink ID="ScriptLink5" runat="server" Name="SprocketComplete/js/sprocketComplete.js" Localizable="false"/>
<SharePoint:ScriptLink ID="ScriptLink3" runat="server" Name="SprocketComplete/js/jquery.autocomplete.min.js" Defer="true" Localizable="false" />
<SharePoint:ScriptLink ID="ScriptLink4" runat="server" Name="SprocketComplete/js/lib/jquery.bgiframe.min.js" Defer="true" Localizable="false" />
<SharePoint:ScriptLink ID="ScriptLink2" runat="server" Name="SprocketComplete/js/jquery.min.js" Defer="true" Localizable="false" />


I tried changing the path to my js as @Djeeg suggested, but now nothing happens. Below is my javascript. It seems like "test" should pop up (also, I am including a jQuery library the same way I am including sprocketComplete.js)

$(document).ready(function () {

2 Answers 2


Try removing the LAYOUTS from the ScriptLink

<SharePoint:ScriptLink ID="ScriptLink5" runat="server" Name="SprocketComplete/js/sprocketComplete.js" Localizable="false"/>

Microsoft.SharePoint.WebControls.ScriptLink+ScriptLinkInfo has

public string ToScriptUrl(Page page)

Which does

return SPHttpUtility.UrlPathEncode(SPUtility.MakeBrowserCacheSafeLayoutsUrl(filename, this.Localizable), true);

So the base url is /_layouts/

  • No more error, but nothing happens either. See update 2 in my original question to see the Javascript that should be executed. Apr 12, 2011 at 4:09
  • Scratch that, it looks like jQuery isn't loading for some reason. Any suggestions for why that wouldn't be loading? Apr 12, 2011 at 4:15
  • try adding 'alert("loaded SprocketComplete");' at the start of the js file, it might be that jquery has not loaded yet (see your other question i answered)
    – djeeg
    Apr 12, 2011 at 4:16
  • i dont think you want the Defer="true" flag set
    – djeeg
    Apr 12, 2011 at 4:16
  • 1
    and the jquery.js must be above the SprocketComplete.js
    – djeeg
    Apr 12, 2011 at 4:18

First of all I am assuming a full-trust solution since you are deploying script files into the layouts folder.

First word of advice. Configuring 'Copy Always' does not do anything for you since that would copy the file into the BIN/DEBUG folder of your project. Not what you are looking for.

What should work for you is to add your js file to a subfolder in layouts and configure your ScriptLink control as follows

SharePoint:ScriptLink  runat="server" Name="SharePointProject1/Demo.js" Localizable="false"
  • Are you saying copy the js file to the subfolder in layouts on the file system or in my project? Apr 12, 2011 at 18:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.