Cannot install local plugin on remote PeerTube server

I have connected to the remote server using the CLI from documentation. When i try to install a plugin from npm server It is installed correctly. However, when i try to install my custom plugin from my machine to the PeerTube server using same process, I get the following error in my local machine.

Cannot install plugin. Error: expected 200 "OK", got 400 "Bad Request"
    at buildRequest (/var/www/PeerTube/dist/shared/extra-utils/requests/requests.js:120:13)
    at Object.makePostBodyRequest (/var/www/PeerTube/dist/shared/extra-utils/requests/requests.js:72:12)
    at PluginsCommand.postBodyRequest (/var/www/PeerTube/dist/shared/extra-utils/shared/abstract-command.js:37:27)
    at PluginsCommand.install (/var/www/PeerTube/dist/shared/extra-utils/server/plugins-command.js:64:21)
    at /var/www/PeerTube/dist/server/tools/peertube-plugins.js:97:34
    at Generator.next (<anonymous>)
    at fulfilled (/var/www/PeerTube/node_modules/tslib/tslib.js:114:62)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
----
    at Test._assertStatus (/var/www/PeerTube/node_modules/supertest/lib/test.js:304:12)
    at /var/www/PeerTube/node_modules/supertest/lib/test.js:80:15
    at Test._assertFunction (/var/www/PeerTube/node_modules/supertest/lib/test.js:338:11)
    at Test.assert (/var/www/PeerTube/node_modules/supertest/lib/test.js:209:21)
    at localAssert (/var/www/PeerTube/node_modules/supertest/lib/test.js:167:12)
    at /var/www/PeerTube/node_modules/supertest/lib/test.js:164:5
    at Test.Request.callback (/var/www/PeerTube/node_modules/superagent/lib/node/index.js:905:3)
    at /var/www/PeerTube/node_modules/superagent/lib/node/index.js:1127:20
    at IncomingMessage.<anonymous> (/var/www/PeerTube/node_modules/superagent/lib/node/parsers/json.js:22:7)
    at IncomingMessage.emit (events.js:326:22)

And the error that i got in my root>Administration>System logs.

error[9/20/2021, 10:53:20 AM] Cannot install plugin /var/www/peertube-plugin-someplugin/, removing it...

{

  "err": {

    "err": {

      "stack": "Error: Command failed: yarn add file:/var/www/peertube-plugin-someplugin/\nwarning package.json: No license field\nwarning No license field\nerror Package \"file:/var/www/peertube-plugin-someplugin/\" refers to a non-existing file '\"/var/www/peertube-plugin-someplugin/\"'.\n\n    at ChildProcess.exithandler (child_process.js:308:12)\n    at ChildProcess.emit (events.js:314:20)\n    at ChildProcess.EventEmitter.emit (domain.js:483:12)\n    at maybeClose (internal/child_process.js:1022:16)\n    at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)",

      "message": "Command failed: yarn add file:/var/www/peertube-plugin-someplugin/\nwarning package.json: No license field\nwarning No license field\nerror Package \"file:/var/www/peertube-plugin-someplugin/\" refers to a non-existing file '\"/var/www/peertube-plugin-someplugin/\"'.\n",

      "killed": false,

      "code": 1,

      "signal": null,

      "cmd": "yarn add file:/var/www/peertube-plugin-someplugin/"

    },

    "stdout": "yarn add v1.22.11\n[1/4] Resolving packages...\ninfo Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.\n",

    "stderr": "warning package.json: No license field\nwarning No license field\nerror Package \"file:/var/www/peertube-plugin-someplugin/\" refers to a non-existing file '\"/var/www/peertube-plugin-someplugin/\"'.\n"

  }

}

error[9/20/2021, 10:53:20 AM] Cannot uninstall plugin /var/www/peertube-plugin-someplugin/ after failed installation.

{

  "err": {

    "stack": "TypeError: Cannot read property 'replace' of undefined\n    at Function.normalizePluginName (/var/www/peertube/versions/peertube-v3.4.0/dist/server/models/server/plugin.js:152:24)\n    at Function.loadByNpmName (/var/www/peertube/versions/peertube-v3.4.0/dist/server/models/server/plugin.js:22:27)\n    at PluginManager.<anonymous> (/var/www/peertube/versions/peertube-v3.4.0/dist/server/lib/plugins/plugin-manager.js:266:55)\n    at Generator.throw (<anonymous>)\n    at rejected (/var/www/peertube/versions/peertube-v3.4.0/node_modules/tslib/tslib.js:115:69)\n    at runMicrotasks (<anonymous>)\n    at processTicksAndRejections (internal/process/task_queues.js:97:5)",

    "message": "Cannot read property 'replace' of undefined"

  }

}

error[9/20/2021, 10:53:20 AM] Cannot remove plugin /var/www/peertube-plugin-someplugin/ after failed installation.

{

  "err": {

    "stack": "Error: Invalid NPM plugin name to install\n    at checkNpmPluginNameOrThrow (/var/www/peertube/versions/peertube-v3.4.0/dist/server/lib/plugins/yarn.js:57:15)\n    at Object.<anonymous> (/var/www/peertube/versions/peertube-v3.4.0/dist/server/lib/plugins/yarn.js:34:9)\n    at Generator.next (<anonymous>)\n    at /var/www/peertube/versions/peertube-v3.4.0/node_modules/tslib/tslib.js:117:75\n    at new Promise (<anonymous>)\n    at Object.__awaiter (/var/www/peertube/versions/peertube-v3.4.0/node_modules/tslib/tslib.js:113:16)\n    at Object.removeNpmPlugin (/var/www/peertube/versions/peertube-v3.4.0/dist/server/lib/plugins/yarn.js:33:20)\n    at PluginManager.<anonymous> (/var/www/peertube/versions/peertube-v3.4.0/dist/server/lib/plugins/plugin-manager.js:233:38)\n    at Generator.throw (<anonymous>)\n    at rejected (/var/www/peertube/versions/peertube-v3.4.0/node_modules/tslib/tslib.js:115:69)\n    at runMicrotasks (<anonymous>)\n    at processTicksAndRejections (internal/process/task_queues.js:97:5)",

    "message": "Invalid NPM plugin name to install"

  }

}

Files need to be on the server.
That’s why I mentionned rsync in my response to your other post

Please don’t open multiple threads for the same subject.
And please don’t @ us for every questions you have. Forum members will respond when they can. We already have enough notifications.

1 « J'aime »

Ps: in my previous response, on the other thread, I used ssh to launch the CLI on the server. As you have setup the CLI on your dev env, no need to use ssh. You can use the CLI on your dev computer. But the path is a path were to find the plugin ON THE SERVER.
Rsync is a command that synchronise a folder over ssh (see the other thread for the exact rsync call)

Did you manage to install your plugin?

Yes @JohnLivingston, We did manage to install the plugin. We also got the idea how to install the plugin in docker deployed environment (Not remotely). If it is needed we can provide the steps so, that it can be updated in PeerTube official documentation. Thank You for your help :slight_smile:

Great news.
I think it would be great that you make a pull request on the official documentation to add:

  • that the path is a local path on the server
  • how to achieve this to docker.