bencarr / statamic-hyperlink

Hyperlink is a Statamic addon that expands the default Link fieldtype and allows you to store link text and target options alongside the link destination.
https://statamic.com/addons/bencarr/hyperlink
3 stars 1 forks source link

Hyperlink fieldtype doesn't appear on distant/production env #1

Closed mediactive closed 1 year ago

mediactive commented 1 year ago

Hi! I have successfully installed this addon on my local/dev env. It works very well on local env. But It doesn't work on my distant/production env. I think I have sent all the necessary files to the server. And I have associated my site with this addon in my Statamic account.

Do you know why this is not working on distant/production env?

Regards,

Jerome

bencarr commented 1 year ago

Hi Jerome! Can you share some more details about how you’re deploying to the distant/production environment? Are there any JavaScript errors in the console on production?

One initial thing to check: during a composer install, Hyperlink downloads its compiled assets from the latest GitHub release to public/vendor/statamic-hyperlink — those files would need to be available on production as well if you’re not running composer install on the actual environment.

mediactive commented 1 year ago

Hi Ben!

I deployed Hyperlink by transferring the files via FTP. There are no Javascript errors in the production console. I transferred the public/vendor/statamic-hyperlink folder to the remote server. It only contains the js/addon.js file.

I'm trying to install Hyperlink from the addon installer available in Statamic's control panel. I get this error:

In PluginManager.php line 738:
  pixelfear/composer-dist-plugin contains a Composer plugin which is blocked   
  by your allow-plugins config. You may add it to the list if you consider it  
   safe.                                                                       
  You can run "composer config --no-plugins allow-plugins.pixelfear/composer-  
  dist-plugin [true|false]" to enable it (true) or disable it explicitly and   
  suppress this exception (false)                                              
  See https://getcomposer.org/allow-plugins

Warning: Composer should be invoked via the CLI version of PHP, not the cgi-fcgi SAPI

Thanks for your help!

bencarr commented 1 year ago

Ah, you'll need to update your allow-plugins config in composer.json to include the pixelfear/composer-dist-plugin plugin. The allow-plugins config was added in Composer 2.2.0 as an additional security measure. Statamic itself uses that plugin, and it's included in the Statamic new site/app package.

You can mark it as allowed by running the command in the error you posted:

composer config --no-plugins allow-plugins.pixelfear/composer-dist-plugin true

Or by updating your composer.json to match what's in the new site/app package:

{
    "config": {
        "allow-plugins": {
            "composer/package-versions-deprecated": true,
            "pixelfear/composer-dist-plugin": true
        }
    }
}
mediactive commented 1 year ago

Hi Ben!

I had already checked my composer.json file. It contained this code:

        "allow-plugins": {
            "composer/package-versions-deprecated": true,
            "pixelfear/composer-dist-plugin": true
        }

But despite that, I get this error message:

In PluginManager.php line 738:
  pixelfear/composer-dist-plugin contains a Composer plugin which is blocked   
  by your allow-plugins config. You may add it to the list if you consider it  
   safe.                                                                       
  You can run "composer config --no-plugins allow-plugins.pixelfear/composer-  
  dist-plugin [true|false]" to enable it (true) or disable it explicitly and   
  suppress this exception (false)                                              
  See https://getcomposer.org/allow-plugins

I will find out about this with the Statamic team.

Thanks!

bencarr commented 1 year ago

Hoping this was resolved with help from the Statamic team! Feel free to reopen if the problem seems Hyperlink-specific.