Why can't I install plugins locally?

I’m using the latest version of Discourse, and I’ve tried installing valid plugins in the /var/discourse/plugins directory. I copy the plugin folders there, but they never install, obviously, I always use ./launcher rebuild app. The only way I can install them is by using app.yml.

I want to install it offline for testing purposes. I don’t want to open a github repository to install a test plugin, it seems counterproductive to me.

Perhaps set up a development environment instead of a production site? You can clone repos directly into the plugins directory. Plus, it won’t affect data on your production site and won’t cause downtime to your users when you rebuild. See Discourse Meta - dev-install guides for all topics on how to set up a dev environment.

Is the installation of local plugins blocked in a production environment? Is it possible to convert a production environment into a dev environment without having to redo everything?

You could maybe take a backup of your PRD and restore it locally?

Okay, the only thing left to know is if local plugin installation is blocked in production. Let’s hope someone knows.

Not “blocked” but just doesn’t work.

As Nate said, the best route is to setup a local dev env, or continue using app.yml if you prefer that.

And why is it standard practice to make the source code public when installing plugins in production? Does that mean Discourse doesn’t allow private plugins? Even a repository with a token is still a public plugin on the platform where it’s hosted (GitHub, GitLab, etc.)

A private GitHub/GitLab repo is still private. The token is just a password that lets the server clone it. Nobody else can see the code. It stays private.

See the section about private repos in Install plugins on a self-hosted site

Use a development setup locally to test plugins. dev-install

Otherwise you must run full production rebuild every time you change plugins which is a waste of time, especially since the team has recently brought development builds down to a few seconds.

Clone plugins in ~/code or equivalent then you can symlink them from the plugins directory.