title: How do I fix this npm install conflict between existing files & symlinks?
body: <p>I'm running into a problem with <a href="https://www.npmjs.com" rel="noreferrer">NPM</a>, where it seems to be detecting a conflict between an existing file &amp; a symlink, with the same name.
  I don't see any symlinks when running <code>ls -l</code> from my project's root folder. How do I figure out what's going on with NPM &amp; straighten out this conflict?</p>
  
  <p>The continuous integration build server is running: <a href="https://nodejs.org" rel="noreferrer">Node.js</a> 4.4.3 = latest LTS build.</p>
  
  <p>My localhost Node 5.x box switches to using phantomjs-prebuilt, due to this warning... so updating the Node server version from 4.4.3 -> 5.10.1 isn't the issue, nor the correct fix:</p>
  
  <pre><code>npm WARN deprecated phantomjs@2.1.7: Package renamed to phantomjs-prebuilt. Please update 'phantomjs' package references to 'phantomjs-prebuilt'
  </code></pre>
  
  <p>I don't have either of these in any of my *.js code, so I don't know where this is being required from nor why:</p>
  
  <pre><code>require("phantomjs") 
  require("phantomjs-prebuilt")
  </code></pre>
  
  <p>Searching for this phrase on <a href="https://www.google.com/webhp?sourceid=chrome-instant&amp;ion=1&amp;espv=2&amp;ie=UTF-8#q=%22npm+ERR!+EEXIST:+file+already+exists%2C+symlink%22+%2B+%22%27..%2Fphantomjs%2Fbin%2Fphantomjs%27%22" rel="noreferrer">Google</a> &amp; <a href="https://stackoverflow.com/search?q=npm+ERR%21+EEXIST%3A+file+already+exists+symlink">SO</a>, haven't produced enough useful results to solve my problem:</p>
  
  <pre><code>"npm ERR! EEXIST: file already exists, symlink"
  </code></pre>
  
  <p>Here is what I've already tried running:</p>
  
  <pre><code>npm uninstall -g phantomjs
  npm WARN not installed in /.../.nvm/versions/node/v4/lib/node_modules: "phantomjs"
  
  rm -rf node_modules // to delete that folder
  npm install
  
  npm ERR! EEXIST: file already exists, symlink '../phantomjs-prebuilt/bin/phantomjs' -&gt; '/.../node_modules/.bin/phantomjs'
  File exists: ../phantomjs-prebuilt/bin/phantomjs
  Move it away, and try again.
  </code></pre>
  
  <p>A screenshot of what this error looks like was found on the web using Google. Scroll to the bottom of the <a href="https://travis-ci.org/RangerRick/CruiseMonkey" rel="noreferrer">CI server's code example</a>. (Note: That is someone else's screenshot, but it looks similar to mine.) </p>
  
  <p>Using <code>npm list</code> or <code>npm ls</code> shows phantomjs is installed:</p>
  
  <pre><code>├── phantomjs@2.1.7
  </code></pre>
  
  <p>Using <code>npm ls -g</code> shows a blank list. I assume that means that there aren't any packages, nor symlinks installed into a global area.</p>
  
  <p>I've tried uninstalling phantomjs using:</p>
  
  <pre><code>npm uninstall -g phantomjs
  npm WARN not installed in /.../.nvm/versions/node/v4/lib/node_modules: "phantomjs"
  </code></pre>
  
  <p>I've also tried using <a href="https://stackoverflow.com/users/128346/wilmoore">wilmore</a>'s idea from his answer at this <a href="https://stackoverflow.com/questions/19572764/homebrew-repeated-linking-bug-what-is-the-underlying-issue-here">Homebrew - repeated “linking” bug. What is the underlying issue here?</a> question: </p>
  
  <pre><code>brew link --overwrite phantomjs
  Warning: Already linked: /usr/local/homebrew/Cellar/phantomjs/2.1.1
  To relink: brew unlink phantomjs &amp;&amp; brew link phantomjs
  </code></pre>
  
  <p>That led me to choose the 1st option from that last line:</p>
  
  <pre><code>brew unlink phantomjs
  Unlinking /usr/local/homebrew/Cellar/phantomjs/2.1.1... 2 symlinks removed
  </code></pre>
  
  <p>When I re-run: </p>
  
  <pre><code>npm install
  </code></pre>
  
  <p>It still trips over this error:</p>
  
  <pre><code>npm ERR! EEXIST: file already exists, symlink '../phantomjs-prebuilt/bin/phantomjs' -&gt; '/.../node_modules/.bin/phantomjs'
  File exists: ../phantomjs-prebuilt/bin/phantomjs
  Move it away, and try again.
  </code></pre>
  
  <p>How do I debug symlinks further &amp; fix this <code>npm install</code> conflict between existing files &amp; symlinks?</p>