Package install error

Hi,
I’m trying to make my first custom package that collects a custom module with its functionality.
When I try to install it I get the following error:

I report the code in the package manifest

$manifest = array (
  0 =>
  array (
    'acceptable_sugar_versions' =>
    array (
      0 => '',
    ),
  ),
  1 =>
  array (
    'acceptable_sugar_flavors' =>
    array (
      0 => 'CE',
      1 => 'PRO',
      2 => 'ENT',
    ),
  ),
  'readme' => '',
  'key' => 'NP',
  'author' => 'Marco Bullo',
  'description' => '',
  'icon' => '',
  'is_uninstallable' => true,
  'name' => 'Note_Plus',
  'published_date' => '2021-01-27 08:40:04',
  'type' => 'module',
  'version' => 1611736804,
  'remove_tables' => 'prompt',
);


$installdefs = array (
  'id' => 'Note_Plus',
  'beans' =>
  array (
    0 =>
    array (
      'module' => 'NP_NotePlus',
      'class' => 'NP_NotePlus',
      'path' => 'modules/NP_NotePlus/NP_NotePlus.php',
      'tab' => true,
    ),
  ),
  'layoutdefs' =>
  array (
  ),
  'relationships' =>
  array (
  ),
  'image_dir' => '<basepath>/icons',
  'copy' =>
  array (
    0 =>
    array (
      'from' => '<basepath>/SugarModules/modules/NP_NotePlus',
      'to' => 'modules/NP_NotePlus',
    ),
    1 =>
    array (
      'from' => '<basepath>/SugarModules/custom/modules/NP_NotePlus',
      'to' => 'custom/modules/NP_NotePlus',
    ),
    2 => array (
        'from' => '<basepath>/SugarModules/custom/Extension/modules/NP_NotePlus/Ext/ActionViewMap',
        'to' => '/custom/Extension/modules/NP_NotePlus/Ext/ActionViewMap',
    ),
    3 => array (
        'from' => '<basepath>/SugarModules/custom/Extension/modules/NP_NotePlus/Ext/Language',
        'to' => '/custom/Extension/modules/NP_NotePlus/Ext/Language',
    ),
    4 => array (
        'from' => '<basepath>/SugarModules/custom/Extension/modules/NP_NotePlus/Ext/Layoutdefs',
        'to' => '/custom/Extension/modules/NP_NotePlus/Ext/Layoutdefs',
    ),
    5 => array (
        'from' => '<basepath>/SugarModules/custom/Extension/modules/NP_NotePlus/Ext/LogicHooks',
        'to' => '/custom/Extension/modules/NP_NotePlus/Ext/LogicHooks',
    ),
    6 => array (
        'from' => '<basepath>/SugarModules/custom/Extension/modules/NP_NotePlus/Ext/Vardefs',
        'to' => '/custom/Extension/modules/NP_NotePlus/Ext/Vardefs',
    ),
    7 => array (
        'from' => '<basepath>/SugarModules/custom/Extension/modules/Administration/Ext/Administration/np_note_plus.php',
        'to' => '/custom/Extension/modules/Administration/Ext/Administration/np_note_plus.php',
    ),
    8 => array (
        'from' => '<basepath>/SugarModules/custom/Extension/modules/Administration/Ext/Language/it_it.np_note_plus.php',
        'to' => '/custom/Extension/modules/Administration/Ext/Language/it_it.np_note_plus.php',
    ),
    9 => array (
        'from' => '<basepath>/SugarModules/custom/Extension/application/Ext/Utils/gestRelationships.php',
        'to' => '/custom/Extension/application/Ext/Utils/gestRelationships.php',
    ),
  ),
  'language' =>
  array (
    0 =>
    array (
      'from' => '<basepath>/SugarModules/language/application/en_us.lang.php',
      'to_module' => 'application',
      'language' => 'en_us',
    ),
    1 =>
    array (
      'from' => '<basepath>/SugarModules/language/application/it_it.lang.php',
      'to_module' => 'application',
      'language' => 'it_IT',
    ),
  ),
);

Copying to the /modules/NP_NotePlus and /custom/modules/NP_NotePlus folders is done correctly and then it crashes when it has to process the third element of the ‘copy’ array …
I have tried several times to relaunch the file permissions adjustment but the error persists

@web_elinet
Remove symbol ‘/’ . Look at:

Thanks
the copy is now successful.

I realized something else,
even if I had created the script for the post-installation actions (post_install.php)

require_once('modules/Administration/QuickRepairAndRebuild.php');
$randc = new RepairAndClear();
$randc->repairAndClearAll(array('repairDatabase'), array('LBL_ALL_MODULES'), true, false);

it seems that the rebuild and repair is not executed at all because on the DB I was missing the two tables of my custom module np_noteplus and np_noteplus_audit.
These appeared after manually launching repair and rebuild

@web_elinet
Did you insert the code into your script?

ini_set('opcache.enable',false);

Yes, I copied it from the example in your code

if (ini_get('opcache.enable')){
        ini_set('opcache.enable',false);
        require_once('modules/Administration/QuickRepairAndRebuild.php');
        $randc = new RepairAndClear();
        $randc->repairAndClearAll(array('repairDatabase'), array('LBL_ALL_MODULES'), true, false);
        echo nl2br("DataBase rapaired and rebuild because cache for php files enable\n");
    }

@web_elinet

I am again looked carefully your post. The code ini_set('opcache.enable',false); does not matter.

Maybe the problem associated with the second installation.

  1. The first installation was broken, the module was copied but the tables in database didn’t create.
  2. When you did the second installation the instataller saw that the module present and skip step with creating tables.

If you want to make sure that all correct you can do new installation of SuiteCRM and install your package.

OK, so it’s not enough to have deleted the files by hand and tried to reinstall the plugin… would it be necessary to test it on a fresh installation?

@web_elinet

You can delete modules manual. It’s enough easy. Delete directories and files:

  • custom/Extension/application/Ext/Include/Note_Plus.php
  • custom/Extension/modules/NP_NotePlus
  • custom/modules/NP_NotePlus
  • modules/NP_NotePlus
    and do Quick Repair and Rebuild

I see that you to add ‘relationship’, ‘vardefs’ and ‘logichook’. I recommend using special arrays in manifest.php. Look at the documentation https://docs.suitecrm.com/developer/module-installer

Now it works for me,
I have inserted the table creation query in the file post_install.php :+1: