Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to publish CP resources #3102

Closed
AlastairDewar opened this issue Jan 13, 2021 · 6 comments
Closed

Unable to publish CP resources #3102

AlastairDewar opened this issue Jan 13, 2021 · 6 comments

Comments

@AlastairDewar
Copy link

AlastairDewar commented Jan 13, 2021

Bug Description

I was recently moving a local version of Statamic v3 to the cloud via docker.
When it's finished running the composer dump it prints:
Can't locate path: </mydir/vendor/statamic/cms/src/Providers/../../resources/dist>
I've taken a look, and it appears that the AppServiceProvider is looking to copy over a folder resources/dist that no longer exists and I presume the contents of which have been moved up a level.
The functionality to copy the users' directory just before it works as expected.

I'm not sure if the resources for the cp should end up in dist as a result of being compiled, and I've missed something elsewhere or if this is the intended functionality.

How to Reproduce

Local install of Statamic, upload all dir's except node_modules and vendor and run npm/yarn run and composer install as part of the Dockerfile.

Extra Detail

Environment

Statamic version: 3.0.38

PHP version: 7.4

Install method (choose one):

  • Fresh install from statamic/statamic
  • Other (please explain this magic!)

Re-running compilation in Docker as part of build process.

@duncanmcclean
Copy link
Member

How are you installing Statamic? Can you share your composer.json file?

@AlastairDewar
Copy link
Author

I originally installed it in September, so I'm not 100% sure.
Thinking about it again, and based upon my Changelog.md and composer.json I suspect I actually updated an existing Laravel project rather than starting fresh as I previously thought.

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "require": {
        "php": "^7.2.5",
        "fideloper/proxy": "^4.2",
        "fruitcake/laravel-cors": "^2.0",
        "guzzlehttp/guzzle": "^6.3",
        "laravel/framework": "^7.0",
        "laravel/tinker": "^2.0",
        "statamic/cms": "^3.0"
    },
    "require-dev": {
        "facade/ignition": "^2.0",
        "fzaninotto/faker": "^1.9.1",
        "mockery/mockery": "^1.3.1",
        "nunomaduro/collision": "^4.1",
        "phpunit/phpunit": "^8.5"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/"
        },
        "classmap": [
            "database/seeds",
            "database/factories"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi",
            "@php artisan statamic:install --ansi"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    }
}

@duncanmcclean
Copy link
Member

Okay! Could you try clearing your composer cache with composer cache-clear and then running composer update to ensure what you've got is defiantly the latest release?

Also, do you know which version of Composer you're using? composer -V will tell you.

The resources/dist directory is ignored in Git and is only shipped when a release is published on Github. Composer then takes the release dist directory and should deal with it (not sure how that bit works but it usually does).

Hopefully one of those steps should get the issue resolved!

@AlastairDewar
Copy link
Author

Running composer clear and composer update didn't offer anything different I'm afraid.

I'm using Composer version 2.0.8 2020-12-03 17:20:38 locally and the exact same version within Docker.

It is worth noting that it runs fine locally, and that it's only when building my app as a container that it fails.

I'm wary of it being docker or my mounting of volumes, but I'm just running composer install on my local version of composer.lock with no vendor folder copied over.

I found it weird that the users copy worked fine and thought it might have been a simple mistake, but perhaps it's this final step in composer that's not running in the Docker environment.

I'll look into the above step, and failing that I'll try installing a fresh copy. If I find a solution I'll comment below.

Thanks very much for your help, and feel free to close the ticket - it doesn't sound like there's an issue with the package so much as with my Docker setup.

@duncanmcclean
Copy link
Member

duncanmcclean commented Jan 13, 2021

Alright, I'll close this issue.

If you don't find anything weird in your setup, it may be worth to make an issue on this package instead? It's what is used by Statamic to do the magic stuff with the resources.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants