I've solved this whereby I got these 2 errors. Raising this issue as fixed to help any other poor soul avoid these obscure errors.

> ln -s -f git-hooks/pre-commit .git/hooks/pre-commit
Class Acquia\Lightning\Composer\Package is not autoloadable, can not call package script

AND also, when running drush clear cache: ( cd docroot then drush cr )
I got:

In Extension.php line 155:
                                                                                          
  SplFileInfo::getMTime(): stat failed for profiles/contrib/lightning/lightning.info.yml  

These 2 issues are related in that fixing my composer.json file fixed both of them.
The diff of before and after the fix is below.

Detailed summary of fix

In summary, I repaired my composer.json by getting the latest lightning code into a separate code folder and comparing the composer.json in it with mine using Beyond Compare and then cherry-picking across the things I thought I should need for my composer.json and in doing so overwriting and removing some stuff in my composer.json.
To get this latest lightning code I pulled down the latest lightning build using the usual composer create-project acquia/lightning-project MYPROJECT as per the lightning project page ( https://www.drupal.org/project/lightning )

Solution in a nutshell

In a nutshell I just needed to move my custom requires into the new version of composer.json from the newer lightning build.
I think that my composer.json having duplicate requires might have been the root cause of the errors. I now have one section with the original lightning stuff in and the contrib modules I want.

So hopefully happy days again. I would guess that this approach of pulling the latest lightning separately might have to be done again as it would seem that, with lightning, the composer update to update composer.json itself doesn't work very well at the moment.

Thoughts on composer, composer.json and git for tracking project/custom module and sub-theme code changes, distro changes and contrib modules and themes

Because I am building a bespoke site based on lightning - as you do - I manage the custom module code with git and also composer.json in git. composer.json itself with composer manages updates to contrib modules and (I would hope) the lightning distro itself. I don't know whether it is a good idea to try to manage updates to the composer.json in a bespoke project via git pulls from the official lightning repo since the composer.json itself has custom items (such as specific added contrib modules) in it that are tracked in the projects own repo.

The diff between my broken and fixed composer.json

git diff earlier-commit-with-broken later-commit-with-fixed

index 1043c7e..1973c40 100644
--- a/composer.json
+++ b/composer.json
@@ -1,24 +1,53 @@
 {
-    "name": "acquia/lightning",
-    "description": "The best of Drupal, curated by Acquia",
-    "type": "drupal-profile",
-    "license": "GPL-2.0-or-later",
+    "name": "acquia/lightning-project",
+    "description": "Project template for Drupal 8 sites built with the Lightning distribution.",
+    "type": "project",
+    "license": "GPL-2.0+",
     "minimum-stability": "dev",
     "prefer-stable": true,
     "require-dev": {
-        "drupal/media_entity_generic": "1.x-dev",
+        "drush/drush": "^9.0",
+        "drupal/media_entity_generic": "^1.0",
         "acquia/lightning_dev": "dev-8.x-1.x"
     },
-    "bin": [
-        "lightning-subprofile"
-    ],
-    "config": {
-        "preferred-install": {
-            "drupal/core": "dist"
-        },
-        "platform": {
-            "php": "7.0.8"
-        }
+    "require": {
+        "drupal-composer/drupal-scaffold": "^2.0.0",
+        "cweagans/composer-patches": "^1.6.0",
+        "acquia/lightning": "~3.2.0",
+       "drupal/bootstrap": "^3.11",
+        "drupal/superfish": "^1.2",
+        "drupal/nice_menus": "^1.0@beta",
+        "drupal/masonry": "^1.0@RC",
+        "drupal/colorbox": "^1.4",
+        "drupal/ng_lightbox": "^1.0@beta",
+        "drupal/colorbox_load": "^1.0@RC",
+        "drupal/entityqueue": "^1.0@alpha",
+        "drupal/masonry_views": "^1.0@RC",
+        "drupal/draggableviews": "1.x-dev",
+        "drupal/entity_reference_views_select": "^1.3",
+        "drupal/colorbox_inline": "^1.0",
+        "drupal/address": "~1.0",
+        "drupal/geolocation_address_link": "^1.1",
+        "drupal/plupload_widget": "^1.0",
+        "drupal/plupload": "^1.0@beta",
+        "drupal/autocomplete_deluxe": "^1.0@beta",
+        "drupal/dropzonejs": "^2.0@alpha",
+        "drupal/viewfield": "^3.0@alpha",
+        "drupal/profile": "^1.0@RC",
+        "drupal/paragraphs": "^1.3",
+        "drupal/ds": "3.1",
+        "drupal/bootstrap_layouts": "5.1",
+        "drupal/color_field": "^1.0",
+        "drupal/geofield": "^1.0@beta",
+        "drupal/geofield_map": "^2.10",
+        "drupal/leaflet": "^1.0@beta",
+        "drupal/geolocation": "2.x-dev",
+        "drupal/openlayersd8": "^1.1",
+        "drupal/bricks": "^1.6",
+        "drupal/we_megamenu": "^1.2",
+        "drupal/menu_item_extras": "^2.3",
+        "drupal/menu_link_attributes": "^1.0",
+        "drush/drush": "^9.4"
     },
     "repositories": {
         "drupal": {
@@ -35,25 +64,17 @@
             "no-api": true
         }
     },
+    "config": {
+        "process-timeout": 0
+    },
     "scripts": {
-        "post-install-cmd": [
-            "@composer drupal-scaffold",
-            "@composer push",
-            "ln -s -f git-hooks/pre-commit .git/hooks/pre-commit"
-        ],
-        "post-update-cmd": [
-            "@composer push",
-            "ln -s -f git-hooks/pre-commit .git/hooks/pre-commit",
-            "@composer package"
-        ],
-        "drupal-scaffold": "DrupalComposer\\DrupalScaffold\\Plugin::scaffold",
-        "package": "Acquia\\Lightning\\Composer\\Package::execute",
-        "release-version": "Acquia\\Lightning\\Composer\\ReleaseVersion::execute",
-        "verify-patched-constraints": "Acquia\\Lightning\\Composer\\PatchedConstraint::execute",
-        "enable-asset-packagist": "Acquia\\Lightning\\Composer\\AssetPackagist::execute",
-        "nuke": "rm -r -f docroot vendor",
-        "pull": "Acquia\\Lightning\\Commands\\FileCommands::pull",
-        "push": "Acquia\\Lightning\\Commands\\FileCommands::push"
+        "post-install-cmd": "DrupalComposer\\DrupalScaffold\\Plugin::scaffold",
+        "post-update-cmd": "DrupalComposer\\DrupalScaffold\\Plugin::scaffold",
+        "nuke": "rm -r -f docroot/modules/contrib docroot/profiles/contrib/lightning vendor composer.lock",
+        "quick-start": [
+            "composer install",
+            "php docroot/core/scripts/drupal quick-start lightning --no-interaction"
+        ]
     },
     "extra": {
         "installer-types": [
@@ -77,12 +98,12 @@
             ],
             "docroot/themes/contrib/{$name}": [
                 "type:drupal-theme"
+            ],
+            "drush/contrib/{$name}": [
+                "type:drupal-drush"
             ]
         },
         "enable-patching": true,
-        "patchLevel": {
-            "drupal/core": "-p2"
-        },
         "patches": {
           "drupal/draggableviews": { 
             "DraggableViews displays multiple node instances when used in multiple views": "https://www.drupal.org/files/issues/draggableviews_displays-2867159-30.patch",
@@ -92,55 +113,5 @@
             "View Row number as Marker label not displaying": "https://www.drupal.org/files/issues/2018-03-28/row_number_marker_label-29556611-6.patch"
           }
         }
-    },
-    "require": {
-        "cweagans/composer-patches": "^1.6.4",
-        "drupal/lightning_api": "2.x-dev",
-        "drupal/lightning_core": "2.x-dev",
-        "drupal/lightning_layout": "1.x-dev",
-        "drupal/lightning_media": "2.x-dev",
-        "drupal/lightning_workflow": "2.x-dev",
-        "drupal-composer/drupal-scaffold": "^2.0.0",
-        "oomphinc/composer-installers-extender": "^1.1",
-        "drupal/bootstrap": "^3.11",
-        "drupal/superfish": "^1.2",
-        "drupal/nice_menus": "^1.0@beta",
-        "drupal/masonry": "^1.0@RC",
-        "drupal/colorbox": "^1.4",
-        "drupal/ng_lightbox": "^1.0@beta",
-        "drupal/colorbox_load": "^1.0@RC",
-        "drupal/entityqueue": "^1.0@alpha",
-        "drupal/masonry_views": "^1.0@RC",
-        "drupal/draggableviews": "1.x-dev",
-        "drupal/entity_reference_views_select": "^1.3",
-        "drupal/colorbox_inline": "^1.0",
-        "drupal/address": "~1.0",
-        "drupal/geolocation_address_link": "^1.1",
-        "drupal/plupload_widget": "^1.0",
-        "drupal/plupload": "^1.0@beta",
-        "drupal/autocomplete_deluxe": "^1.0@beta",
-        "drupal/dropzonejs": "^2.0@alpha",
-        "drupal/viewfield": "^3.0@alpha",
-        "drupal/profile": "^1.0@RC",
-        "drupal/paragraphs": "^1.3",
-        "drupal/ds": "3.1",
-        "drupal/bootstrap_layouts": "5.1",
-        "drupal/color_field": "^1.0",
-        "drupal/geofield": "^1.0@beta",
-        "drupal/geofield_map": "^2.10",
-        "drupal/leaflet": "^1.0@beta",
-        "drupal/geolocation": "2.x-dev",
-        "drupal/openlayersd8": "^1.1",
-        "drupal/bricks": "^1.6",
-        "drupal/we_megamenu": "^1.2",
-        "drupal/menu_item_extras": "^2.3",
-        "drupal/menu_link_attributes": "^1.0",
-        "drush/drush": "^9.4"
-    },
-    "autoload": {
-        "psr-4": {
-            "Acquia\\Lightning\\": "src",
-            "Acquia\\LightningExtension\\": "src/LightningExtension"
-        }
     }
 }

Originally I discussed the error here, after searching for a solution and came across something similar:

Comments

therobyouknow created an issue. See original summary.

therobyouknow’s picture

Issue summary: View changes

Status: Fixed » Closed (fixed)

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