In duplicating a site from a dev server to a test server, I'm getting a status report error message "Leaflet library not found." Not sure why this is happening, as the Leaflet library and files did indeed get duplicated. I've also tried deleting and replacing the library, still same problem. Any suggestions?

Comments

rdeboer’s picture

Double check the path into to the libraries directory. Make sure all is in lower case.

dasjo’s picture

i just had the same error

The leaflet javascript library was not found. Please download it into the libraries folder. Also ensure that the library is named leaflet with a lower case "l".

in my case, as i was working with a git repository, the reason was because leaflet contains a .gitignore file which will ignore the dist/*.js files.

if you are working with a similar setup / commit all the files to a site-specific git repository, go to the leaflet/dist folder and do a git add -f *.js in order to add the files.

kyletaylored’s picture

This definitely helped. Thanks!

derekahmedzai’s picture

I just had the same problem, commented out the # dist/*.js line in the .gitignore file.

stinky’s picture

I'm getting the same error message, am not using git so #4 doesn't work for me. Any other ideas?

stinky’s picture

Any ideas on how to get this working?

rdeboer’s picture

On a typical drupal install the path you end up with should be sites/all/libraries/leaflet/dist/leaflet.js

After you've downloaded the Leaflet package from CloudMade, you'll probably have a folder called "Leaflet-Leaflet-c1d410f" or a name like that.
Rename that folder to "leaflet" and move it to sites/all/libraries, so that you get the path shown above.

See also the Leaflet More Maps project page, which has these instructions and is probably a module you want to enable next. It has no downloads and no configuration - yay!

stinky’s picture

I've already done what you've mentioned.

the Leaflet package from CloudeMade is in /sites/all/libraries/leaflet and I verified that there's the dist directory that contains leaflet.js.

and the drupal mod is in /sites/all/modules/leaflet

I have other libraries installed (e.g., ckeditor) and they work fine.

It's almost like it's not finding the correct path and document root, because the log files aren't pointing to the correct location.
For example, one location in the log file is appearing as
http://xxx.library.uaf.edu/dist/leaflet.js?v=0.4
and the correct path should be
http://xxx.library.uaf.edu/site7/sites/all/libraries/dist/leaflet.js?v=0.4

Nitty-Gritty’s picture

This is a fix to a similar but probably unrelated problem. My beginner mistake was to not have the module "Libraries" installed. So even though I had the js library installed at /sites/all/libraries/leaflet, I was getting an error message in the Drupal modules page "Requires: Libraries (missing)". Was very confusing for a while. Like I said, probably unrelated, but in trying to solve it I found this page, so perhaps it will help someone else.

rdeboer’s picture

@Nitty-Gritty:
Yep absence of the "sites/all/modules/libraries" MODULE as opposed to the "sites/all/libraries" library folder is a trap for young players... thanks for mentioning.

I have updated the Leaflet More Maps project page -- I don't have access to the Leaflet project page.

Rik

mac_weber’s picture

Why the library is located at sites/all/libraries/leaflet/dist/?

It should be located at sites/all/libraries/leaflet/

This extra folder /dist/ is not provided by the zip file downloaded from http://leafletjs.com/download.html

Then it breaks drush make because it is not a drupal standard to add extra sub-folders.

A patch is attached to change the code to look at sites/all/libraries/leaflet/.

mac_weber’s picture

Status: Active » Needs review
chi’s picture

Version: 7.x-1.0-beta2 » 7.x-1.x-dev
Component: Miscellaneous » Code
Category: support » bug
Priority: Normal » Major
Status: Needs review » Reviewed & tested by the community

Why the library is located at sites/all/libraries/leaflet/dist/?

It was located there in 4.x branch of leaflet library.

mac_weber’s picture

@Chi the git repo should be used ONLY for building the library from source.

I'm changing other places that had references to the git repository and explaining it in README.txt in this new patch.

mac_weber’s picture

Status: Reviewed & tested by the community » Needs review
burkeker’s picture

The patch at #14 works for me in solving the library not found issue.

rdeboer’s picture

Thanks burkeker for confirming....
A few changes going on here... as mentioned by Mac_Weber, one being that with the arrival of 0.6.x the directory structure no longer has /dist
...
Rik

mac_weber’s picture

Status: Needs review » Reviewed & tested by the community

Changing it to RTBC again, as confirmed by 2 members.
Thank you.

afeijo’s picture

Yep, patch at #14 works! thanks

osopolar’s picture

Thanks, patch works for me too.

jwilson3’s picture

Issue tags: +Documentation

Another vote for RTBC here. The Leaflet library has changed their structure and their recommended download method away from GitHub. Drupal.org has already caught up with this. It is time to get the patch in #14 into the module!

We'll also need to update the Leaflet module documentation on Drupal.org after this gets in.

chrowe’s picture

#14 works great on 7.x-1.0-beta3
This is a serious blocker to getting the module working.

afeijo’s picture

if the module maintainers are too busy to commit this or other improvements, me and mac_weber would be more than happy to help join the crew and take care of it.

just add him or myself and we'll commit and close this issue ASAP.

mac_weber’s picture

Sorry for disappointing you @afeijo, but I am really not interested on co-maintaining this module. It does not fit my needs and it would be too difficult to fix it. Moreover, talking with one of the maintainers he said they have no intentions on using Ctools and other things that would make the module have a better DX. Having all configurations done and saved on Views is also a problem form me, besides Leaflet module can only read values from geofield.

I have started a fork which I've been very excited coding and testing: Mapping Leaflet module. The link explains how Mapping Leaflet module is different than Leaflet module.

Read also my comment at DrupalCon Prague 2013 - Mapping Sprint
Everybody is welcome to help contributing. If you feel so, feel free to contact me.

duaelfr’s picture

Patch #14 still applies and needs to be commited more than ever.
LeafletJS is now in version 0.6.4 and this module only works with 0.6.2 releases (and older ones) from Github (not from the official website)...

jwilson3’s picture

Priority: Major » Critical

Lets bump it to critical, for wider visibility to potential new users getting snubbed by this in the issue queue, until maintainers get a chance to get this in.

rdeboer’s picture

Assigned: Unassigned » rdeboer
Status: Reviewed & tested by the community » Fixed

Patch from #14 applied. Thanks Max Weber!

In summary:
When using Leaflet 7.x-1.x-dev or any official release after 7.x-1.0-beta3, first delete your existing sites/all/libraries/leaflet folder.
Then download the latest stable Leaflet JS library (e.g. 0.6.4 at the time of writing) from http://leafletjs.com/download.html and place it in sites/all/libraries, changing the folder name from leaflet-0.6.4 to leaflet.
The path to the essential .js file should thus be /sites/all/libraries/leaflet/leaflet.js
.

mac_weber’s picture

StatusFileSize
new9.82 KB

Thank you @RdeBoer. I appreciate the git attribution, yet on the git comments you thanked this other guy, Max Weber:
Max Weber

Just joking =)

rdeboer’s picture

Sorry... Mac.... you look so similar, easy to confuse ;-)
Rik

zilla’s picture

seems to find it at /dist/ - but you should explain in peter rabbit english on the documentation that it is just the .js file, or all files/folders in leaflet (images css etc)

jwilson3’s picture

Component: Code » Documentation
Category: bug » task
Priority: Critical » Normal
Status: Fixed » Active

The module documentation page on d.o still needs to be updated:

Download or clone the Leaflet library and place this in folder named "leaflet" in the libraries folder, so that the folder structure is as follows: sites/all/libraries/leaflet. Leaflet will look for the necessary Javascript files in the folder sites/all/libraries/leaflet/dist.

https://drupal.org/node/1645460

rdeboer’s picture

@jwilson# #31:
Thanks for pointing that out. I've updated the documentation on https://drupal.org/node/1645460.
Rik

BTW, it's something you could have edited too! Those documentation pages are accessible to everyone

rdeboer’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jcisio’s picture

Should we release beta4? As beta3 no longer works with the lastest stable version of LeafletJS, this is critical.

rdeboer’s picture

Yep I agree. I've contacted the no.1 maintainer about this privately.

hsiyao’s picture

thanks a lot jcisio for post #35!!!!
my first hurdle was the extra dist folder but when it still didn't work using any possible combination I was kind of lost....
for everybody else in my situation, here's a link to an older version that works with the current leaflet version
https://pypi.python.org/pypi/js.leaflet/0.5

jmpreston’s picture

I'm trying to upgrade Leaflet 7.x-1.0 but it is failing to update.

At the end of the update I received a Requirements Problem status report with a variety of no problem messages but the Leaflet status is:

Leaflet not detected
The version of the Leaflet JavaScript Library library could not be detected.

I downloaded the Leaflet JS library ver .0.6.4 and .0.7.1 and tried them in the sites/libraries/leaflet folder and the /leaflet/dist/ folder but nothing removes this error.

I'm a newbie with Drupal and Leaflet but the map was working on our dev site before this upgrade so Leaflet was finding the directory and leaflet.js. I read the whole thread above and it seems that previous problems were corrected.

Any ideas what to do next? I don't see a config file for Leaflet.

Jim

andreystrelkov’s picture

+1 to jmpreston

timqallen’s picture

Issue summary: View changes
Status: Closed (fixed) » Active

I'm having the same issue. I have tried the 7x-1.0 and the 7x-1.x-dev versions of the Leaflet module, and I have tried the 0.6.4 and 0.7.1 versions of the library. Any thoughts?

Anonymous’s picture

Hello everyone!

I have (had) the same problem with updating the library to version 0.7.1. The current implemented regex pattern for the version number simply does not get the 0.7.1 (in my case).

So I had a look at the hook_library implementation in leaflet.module and found the trouble maker.

$libraries['leaflet'] = array(
   ...
    'version arguments' => array(
      'file' => 'leaflet.js',
      'pattern' => '/version="(\d+\.\d+.\d+)"/',
    ),

So I changed it to:

$libraries['leaflet'] = array(
   ...
    'version arguments' => array(
      'file' => 'leaflet.js',
      'pattern' => '/version="(\d+(\.\d+)+)"/',
    ),

Now my even "maintenance" releases are covered and the library module does not run in circles anymore. :)

Hope that helps. If it does I can provide a patch or the module maintainer just updates the regex pattern.

timqallen’s picture

@mikewink, thank you! Your code in #41 fixed part of my issue. Now my status report indicates that the leaflet library is found, and that is true for 0.6.4 and 0.7.1 versions. I seem to be having some other issue that causes the map to not display through views, but I'm working on sorting that out.

marcoscano’s picture

StatusFileSize
new411 bytes

Perhaps the issue with 0.7.1 might be a different issue, but I can confirm that version 0.7.1 produced an error at the system status report (version not recognized) and applying the modifications indicated in #41 solved the error message for me.

I include here the patch file, for convenience

likewhoa’s picture

Component: Documentation » Code
Category: Task » Bug report
Status: Active » Needs review

Above patch works for me with latest 0.7.x leaflet.

likewhoa’s picture

Component: Code » Documentation
Category: Bug report » Task
Status: Needs review » Fixed

Just noticed that patch in #43 is the same as in #2159309: Leaflet Maps no longer visible in iOS with uid=1, after upgrading Leaflet to 7.x-1.0 so I am closing this. People still having issues should look at the issue mentioned above.

likewhoa’s picture

Component: Documentation » Code
Category: Task » Bug report
Status: Fixed » Closed (duplicate)

Since #2152423: Leaflet Library 0.7.1: The version of the Leaflet library could not be detected has the correct regexp to fix detection of the leaflet version, I will mark this as a duplicate to avoid confusion even though this bug was reported away earlier than #2152423: Leaflet Library 0.7.1: The version of the Leaflet library could not be detected. @maintainer feel free to reopen for whatever reason and apologies if this was uncalled for.

csanders’s picture

Patch #43 worked for me as well. Using latest 0.7.x version.

AlfonsoAB’s picture

@mikewink After updating the module, when trying to update the database, the erros started to show, and couldn't finish the update. Your patch worked like charm, thanks.

jmpreston’s picture

The fix in #41 looks easy enough but I can't find these lines in leaflet.module 7-1.0. I'm rather new to Drupal and don't understand what to do with the suggested patch in #43. Usually I hire a PHP coder but he seems to have disappeared so I'm trying to hack a solution for now.

Any help appreciated!

Jim

rdeboer’s picture

@Jim, #49

Just use the Leaflet dev snapshot 7.x-1.x-dev and you do not have to patch anything as it already has the patch in it.
Also use the 7.x-1.x-dev of the following modules (where desired) and you do not have to patch anything as all these versions were patched 2 days ago to align with the changes in Leaflet:

Leaflet More Maps
Leaflet MarkerCluster
IP Geolocation Views and Maps

jmpreston’s picture

They work, thanks RdeBoer!

mhamed’s picture

With drupal 7.36
I ve got the same problem with the library not detected

downloaded the last version of the leaflet from the mother site
and the error disappeared
http://leafletjs.com/download.html

daniel wentsch’s picture

Problem coming up again using Drupal 7.36 and Leaflet 0.7.3. No matter if Leaflet Module 7.x-1.1 oder 7.x-1.x-dev (2014-Oct-05).

Sorry, my bad. My web server simply had not permissions to read leaflet.js which resulted in the version error message.

Road Kill’s picture

This is still a problem with the Dev version :( I spent about two hours trying to resolve the issues but I still get The version of the Leaflet JavaScript Library library could not be detected. I also used the dev version as recommended but this also failed.This is very disappointing.

ProfeHarol’s picture

Hola, Mi solución Fue:
1. Ir Informe + Informe de Estado
2. pon esto en tu url web: /#overlay=%3Fq%3Dadmin%252Freports%252Flibraries
3. Descargar http://cdn.leafletjs.com/leaflet/v1.0.2/leaflet.zip y descomprimir en sites/all/libraries/leaflet/

F5 para actualizar reporte...

yu3ver’s picture

+1,
And dev version too is not recognized in library.

guillaumeduveau’s picture

When you download Leaftlet, leaflet.js is the minified version so it's harder to find the version number. You can just rename leaflet.js to leaflet.min.js (or delete it) and rename leaflet-src.js to leaflet.js.

Joel MMCC’s picture

@guix re: #57, doing that defeats the whole point of minimization, and will use more server and client resources and data. Better to change the 'file' => 'leaflet.js', line in the patched version to use the 'leaflet-src.js' file for version detection purposes only. But perhaps better still…

To all, especially maintainers: Please see my #2895968-15: Leaflet v1.3.1 and newer 1.x version not recognized. I'm a n00b at Drupal development, but I think we may be going about this whole version-detection thing the wrong way.