I'm running into a problem with NPM, where it seems to be detecting a conflict between an existing file & a symlink, with the same name.
I don't see any symlinks when running ls -l
from my project's root folder. How do I figure out what's going on with NPM & straighten out this conflict?
The continuous integration build server is running: Node.js 4.4.3 = latest LTS build.
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:
npm WARN deprecated phantomjs@2.1.7: Package renamed to phantomjs-prebuilt. Please update 'phantomjs' package references to 'phantomjs-prebuilt'
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:
require("phantomjs")
require("phantomjs-prebuilt")
Searching for this phrase on Google & SO, haven't produced enough useful results to solve my problem:
"npm ERR! EEXIST: file already exists, symlink"
Here is what I've already tried running:
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' -> '/.../node_modules/.bin/phantomjs'
File exists: ../phantomjs-prebuilt/bin/phantomjs
Move it away, and try again.
A screenshot of what this error looks like was found on the web using Google. Scroll to the bottom of the CI server's code example. (Note: That is someone else's screenshot, but it looks similar to mine.)
Using npm list
or npm ls
shows phantomjs is installed:
├── phantomjs@2.1.7
Using npm ls -g
shows a blank list. I assume that means that there aren't any packages, nor symlinks installed into a global area.
I've tried uninstalling phantomjs using:
npm uninstall -g phantomjs
npm WARN not installed in /.../.nvm/versions/node/v4/lib/node_modules: "phantomjs"
I've also tried using wilmore's idea from his answer at this Homebrew - repeated “linking” bug. What is the underlying issue here? question:
brew link --overwrite phantomjs
Warning: Already linked: /usr/local/homebrew/Cellar/phantomjs/2.1.1
To relink: brew unlink phantomjs && brew link phantomjs
That led me to choose the 1st option from that last line:
brew unlink phantomjs
Unlinking /usr/local/homebrew/Cellar/phantomjs/2.1.1... 2 symlinks removed
When I re-run:
npm install
It still trips over this error:
npm ERR! EEXIST: file already exists, symlink '../phantomjs-prebuilt/bin/phantomjs' -> '/.../node_modules/.bin/phantomjs'
File exists: ../phantomjs-prebuilt/bin/phantomjs
Move it away, and try again.
How do I debug symlinks further & fix this npm install
conflict between existing files & symlinks?