• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
composer require get error in centos 7

#1
hi all.

i have my project in CI4 working ok in my VPS (centos 7). Recently, i'm trying to emplement new report funciton, in that function, i need to use PHPSpreadsheet to export data to excel ( https://phpspreadsheet.readthedocs.io/en...ng-started

in my localhost, i run the installation script: composer require phpoffice/phpspreadsheet and it work oki in my localhost

but when i upload my code to the live version, and run the installation script above, i got this error message:

 
Quote:Script bash admin/setup.sh handling the post-update-cmd event returned with error code 127
Installation failed, reverting ./composer.json and ./composer.lock to their original content.

You can see full error in the image below
does anyone have this problem? and how to fix it pls.


Attached Files Thumbnail(s)
   
Reply

#2
so just to clarify your running composer on live server ?


For development on my Linux PC , i'm using apache . I set up my normal user to join apache group and have appropriate chmod level, to run at composer from context of .

Suppose i want phpoffice/phpspreadsheetbeing inside web root


I cd to directory of web app on local host. and run
$ composer require phpoffice/phpspreadsheet
//for some it will be php composer.phar etc


That puts required packages into Vendor along with other stuff (your using appstarter i hope)

When i want to make changes to live (after backing up via cpanel of course :^) )

I just cd INSIDE vendor directory, zip with command line maybe:
Code:
$  zip -r    updatedVendor.zip   .
//notice trailing "."
// at least thats for Linux , no clue for Windows -too long ago it used it

So i don't run composer live because its not necessary just zip in the right way local and via cPanel browse to inside vendor directory on cpanel , and upload with (overright ticked) updatedVendor.zip and then extract it.
Reply

#3
By any chance are you using the development version of CI4, the one hosted on codeigniter4/CodeIgniter4 repo? It seems to me you are not using codeigniter4/framework.

The easiest way out here is use composer require with the --no-scripts flag. But, then again, you SHOULD NOT be using the development version for your production server. Only use the stable version.
Reply

#4
(10-29-2020, 09:33 AM)captain-sensible Wrote: so just to clarify your running composer on live server ?


For development on my Linux PC , i'm using apache . I set up my normal user to join apache group and have appropriate chmod level, to run at composer from context of .

Suppose  i want phpoffice/phpspreadsheetbeing inside web root


I cd to directory of web app on local host. and run
$ composer require phpoffice/phpspreadsheet
//for some it will be php composer.phar etc


That puts required packages into Vendor  along with other stuff (your using appstarter i hope)

When i want to make changes to live (after backing up via cpanel of course :^)  )

I just cd INSIDE vendor directory,  zip with command line maybe:
Code:
$  zip -r    updatedVendor.zip   .
//notice trailing  "."
// at least thats for Linux , no clue for Windows -too long ago it used it

So i don't run composer live because its not necessary just zip in the right way local and via cPanel browse to inside vendor directory on cpanel , and  upload with (overright ticked)  updatedVendor.zip and then extract it.

yeah, my project is running on vps server, and i cd to the project folder then run the $ composer require phpoffice/phpspreadsheet  command
as you can see on my picture. You're right about zipping and upload, i done this after i write this Post, i need it work for my deadline, but i still upload the errro here may be it's an error in CI4 framework or i missing something Big Grin



(10-29-2020, 09:50 AM)paulbalandan Wrote: By any chance are you using the development version of CI4, the one hosted on codeigniter4/CodeIgniter4 repo? It seems to me you are not using codeigniter4/framework.

The easiest way out here is use composer require with the --no-scripts flag. But, then again, you SHOULD NOT be using the development version for your production server. Only use the stable version.

i'm using the laster release CI 4.0.4 of CodeIgniter4/framework  which was downloaded from this link: https://github.com/CodeIgniter4/framewor...tag/v4.0.4
Reply

#5
Ok. That's weird you have the bash script in your framework version. Can you post the details of that's composer.json?
Reply

#6
Quote:Ok. That's weird you have the bash script in your framework version.

i don't understand that part or see why there should be a bash script .

@tmtuan can you elaborate on that bash script ,where it comes from, i can't (maybe i'm blind) see what a bash script has to do with CI4.Of course as a Linux user, i might be highly embarrassed here, when somebody tells me ?

As a Linux user though , i did spot you are using Composer as # (ROOT) , i always use as $; i think i read its not a good idea to use composer as root.

https://getcomposer.org/doc/faqs/how-to-...-safely.md



What i do on dev, is that i part of "users" group also joined the apache group; on dev i make my dir chmod 775 -R

then i can cd into dir and run composer just using $.



When you use composer for software its usually autoloaded, so there's no post install certainly not with bash .


Also if your using composer why not use it from the beginning ?

Code:
composer composer create-project codeigniter4/appstarter --no-dev


i prefer appstarter , it seems that git download is "codeigniter4/codeigniter4-standard": "^1.0


i never really never went deep into differences once i found appstarter met my needs ?

But yes as paul says , post composer.json. Also if anyone wants to educated me why i should use anything else but appstarter?
Reply

#7
If you are using codeigniter4/codeigniter4 as tour base CI4 framework instead of the distributed framework and appstarter versions, your composer.json would have in the post-update-cmd of the scripts section the bash script "bash admin/setup.sh". This is used in development to ensure that contributors will have the specially designed precommit hook installed in the .git folder of their local copy.

I think there was a mixup in your case. Maybe at one time you are using the development version then switched to stable version. In your updating, you forgot to change your composer.json.

Since the problem is in your scripts, you have two options here:
1. Remove the "bash admin/setup.sh" line in your composer.json
2. Run the require with the no scripts option:
Code:
composer require phpoffice/phpspreadsheet --no-scripts

Either way should do the trick.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.