diff --git a/src/ComposerFile.php b/src/ComposerFile.php
index e76d10e..b66d424 100644
--- a/src/ComposerFile.php
+++ b/src/ComposerFile.php
@@ -105,7 +105,7 @@ class ComposerFile implements ComposerFileInterface {
    * @throws \UnexpectedValueException
    */
   public function write(array $filedata) {
-    if (!is_writable($this->filepath)) {
+    if (file_exists($this->filepath) && !is_writable($this->filepath)) {
       throw new \RuntimeException(String::format('@filepath is not writable.', array('@filepath' => $this->filepath)));
     }
 
