Answers.Body: <p>Shame on me, but maybe still interesting to others who have this problem: I'm using vagrant and the path of my extension was NOT mounted to the vagrant box. That's all. So it simply could not find the files. Maybe a warning by craft would be nice, that it can not load the plugin files</p>
  
  <p>Though I do not understand, why it found the composer.json to read the basic information, which showed up in the Plugins section of Craft... </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-02T15:24:21.783Z
Answers.LastActivityDate: 2017-08-02T16:08:54.910Z
Answers.LastEditDate: 2017-08-02T16:08:54.910Z
Answers.UserDisplayName: Matthias Redl-Mann
Body: <p>I'm trying to write my own Craft 3 TWIG filter / functions.</p>
  
  <p>For this purpose I created a scaffolding using pluginfactory.io. I did a <code>composer require</code> and composer correctly symlinks the plugin to the Craft project's vendor directory. When I click "Plugins" in the CP it shows my plugin, but when I click "Install" I get the error:</p>
  
  <p><strong>Call to a member function getVersion() on null</strong></p>
  
  <p>caused in /var/www/html/vendor/craftcms/cms/src/services/Plugins.php on line 328 which is</p>
  
  <pre><code>$info = [
    'handle' =&gt; $handle,
    'version' =&gt; $plugin-&gt;getVersion(), // &lt;== Line 328
    'schemaVersion' =&gt; $plugin-&gt;schemaVersion,
    'installDate' =&gt; Db::prepareDateForDb(new \DateTime()),
  ];
  </code></pre>
  
  <p>Why? I compared my composer.json with e.g. nystudio107/craft3-pathtools and it's almost identical and I definitely have a version defined in my composer.json.</p>
  
  <p>Why is $plugin null?</p>
  
  <p>Any suggestions?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-07-31T23:09:05.390Z
Comments.Text: Can you edit the question and share you main plugin class file (if it has one) as well as your plugin's `composer.json`?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-08-02T15:24:34.483Z
Comments.Text: hey brad: see answer below, only idea: maybe craft should check if the file exists before not being able to initiate the plugin
Comments.UserDisplayName: Matthias Redl-Mann
Tags: <plugin-development><craft3><twigextension>
Title: Create Craft 3 Plugin - Call to a member function getVersion() on null
ThreadText: # Create Craft 3 Plugin - Call to a member function getVersion() on null
  
  (Asked by: username_0 on 2017-07-31)
  
  I'm trying to write my own Craft 3 TWIG filter / functions.
  
  For this purpose I created a scaffolding using pluginfactory.io. I did a `composer require` and composer correctly symlinks the plugin to the Craft project's vendor directory. When I click "Plugins" in the CP it shows my plugin, but when I click "Install" I get the error:
  
  **Call to a member function getVersion() on null**
  
  caused in /var/www/html/vendor/craftcms/cms/src/services/Plugins.php on line 328 which is
  
  ```
  $info = [
    'handle' => $handle,
    'version' => $plugin->getVersion(), // <== Line 328
    'schemaVersion' => $plugin->schemaVersion,
    'installDate' => Db::prepareDateForDb(new \DateTime()),
  ];
  
  ```
  
  Why? I compared my composer.json with e.g. nystudio107/craft3-pathtools and it's almost identical and I definitely have a version defined in my composer.json.
  
  Why is $plugin null?
  
  Any suggestions?
  
  **Tags:** plugin-development, craft3, twigextension
  
  > **Comments:**
  > **username_1**: Can you edit the question and share you main plugin class file (if it has one) as well as your plugin's `composer.json`?  
  > **username_0**: hey username_1: see answer below, only idea: maybe craft should check if the file exists before not being able to initiate the plugin  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2017-08-02. Score: 1 | Accepted answer
  
  Shame on me, but maybe still interesting to others who have this problem: I'm using vagrant and the path of my extension was NOT mounted to the vagrant box. That's all. So it simply could not find the files. Maybe a warning by craft would be nice, that it can not load the plugin files
  
  Though I do not understand, why it found the composer.json to read the basic information, which showed up in the Plugins section of Craft...
  
  
  ---
  
  