Hi.
I've ran this command to create a new Drupal project:
composer create-project drupal-composer/drupal-project:8.x-dev /app --stability dev --no-interaction
When running composer install --no-dev, I get this error:
[RuntimeException]
Could not scan for classes inside "scripts/composer/ScriptHandler.php" which does not appear to be a file nor a folder
I don't know if this is related, but I installed my project to /app, while the composer install output seems to be trying to access files under /var/www (which I've deleted, since I don't use it):
Cannot create cache directory /var/www/.composer/cache/repo/https---packages.drupal.org-8/, or directory is not writable. Proceeding without cache
Cannot create cache directory /var/www/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /var/www/.composer/cache/files/, or directory is not writable. Proceeding without cache
Could not scan for classes inside "scripts/composer/ScriptHandler.php" which does not appear to be a file nor a folder
I suspect there's something with my local setup that's causing this. I'll investigate further...
On the server i ran composer create-project, running composer install works fine. But I've checked the /app folder into source code, and when my build server run composer install, everything works fine until composer start generating autoload files:
<snip>
- Installing drush/drush (9.3.0): Downloading (100%)
- Installing vlucas/phpdotenv (v2.4.0): Downloading (100%)
Generating autoload files
[RuntimeException]
Could not scan for classes inside "scripts/composer/ScriptHandler.php" which does not appear to be a file nor a folder
I suspect composer is looking for ScriptHandler.php in the wrong path. The actual path is /app/composer/ScriptHandler.php, not scripts/composer/ScriptHandler.php that it currently looks for.
In composer.json, I change classmap like this, which seems to have resolved my issue (need more testing to verify):
"classmap": [
"./composer/ScriptHandler.php"
],
This could be related to the absolute path (/app), please try a relative path instead. Could be a bigger composer issue.
I've run into this same issue, just by installing a fresh copy of the project, then in a Dockerfile, running:
FROM composer as vendor
COPY composer.json composer.json
COPY composer.lock composer.lock
RUN composer install \
--ignore-platform-reqs \
--no-interaction \
--no-plugins \
--no-scripts \
--prefer-dist
I'll try that classmap change as well and see if it helps. The composer image installs into ./app as well.
...and now I feel dumb. I forgot to copy in the scripts/ dir in my Dockerfile above. This works:
FROM composer as vendor
COPY composer.json composer.json
COPY composer.lock composer.lock
COPY scripts/ scripts/
COPY web/ web/
RUN composer install \
--ignore-platform-reqs \
--no-interaction \
--no-plugins \
--no-scripts \
--prefer-dist
where location scripts / dir ? i am try search but not found
Here's what I did:
/var/www/.composer/cache/ not writeable error and which I've deleted, since I don't use it definitely sounds like a Composer issue. Would be interesting what $ composer config --global --list | grep cache and whoami returns. I suggest you reinstall Composer and retry.
Please feel free to reopen this issue by adding more info/steps/commands to reproduce this issue.
...and now I feel dumb. I forgot to copy in the scripts/ dir in my Dockerfile above. This works:
FROM composer as vendor COPY composer.json composer.json COPY composer.lock composer.lock COPY scripts/ scripts/ COPY web/ web/ RUN composer install \ --ignore-platform-reqs \ --no-interaction \ --no-plugins \ --no-scripts \ --prefer-dist
OH! Thank you. This was exactly my issue. Thank you
Most helpful comment
...and now I feel dumb. I forgot to copy in the scripts/ dir in my Dockerfile above. This works: