Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Steps to reproduce -
1) Create a view of type 'REST EXport'
2) Set a path (ex- /csv)
3) Under format settings, check option for Force using fields and select 'csv' for accepted request formats
4) On visiting page - /csv , getting followinng fatal error
Fatal error: Class 'League\Csv\Writer' not found in /var/www/cttransit/modules/contrib/csv_serialization/src/Encoder/CsvEncoder.php on line 110
Comments
Comment #2
grasmash CreditAttribution: grasmash commentedHave you followed the installation instructions? You need to install the league CSV library, ideally via composer.
Comment #3
alimc29 CreditAttribution: alimc29 commentedI am getting this error, as well, despite having run
composer require league/csv
from my drupal project.I am running php 5.6.10, and have confirmed I have mbstring enabled. I have also tried with php 7.0.0, and get the same error.
Is there something else I am missing?
update:
I have resolved my issue by using composer_manager (this client's site is not yet on d8.1), and running
composer update drupal/csv_serialization
from my drupal docroot (note: I was initially trying to run this via my sites/sitename directory)Comment #4
grasmash CreditAttribution: grasmash commentedComment #5
maryedith CreditAttribution: maryedith commentedI have just loaded this module into an 8.4.4 site.
Used $composer require drupal/csv_serialization
and got the /league/csv directory ; I am all up to date.
I get the same error:
Fatal error: Class 'League\Csv\Writer' not found in ...../modules/contrib/csv_serialization/src/Encoder/CsvEncoder.php on line 134
Can someone offer suggestions? THanks.
Comment #6
1kenthomas CreditAttribution: 1kenthomas as a volunteer and commented@maryedith:
I just had the same issue after an 8.3.x --> 8.4.4 upgrade, reloading with Composer worked for me. File permissions would be the first thing I looked at, after that. Good luck!
Comment #7
justkristin CreditAttribution: justkristin commentedI am getting this error only when I am trying to not use an enclosure. Is there no way to get the view to work without an enclosure, and only a delimiter?
Comment #8
shubhangi1995I agree with #3, as it solved my problem