link-package
link-package copied to clipboard
Better handle pre-existing, invalid links
The docs say:
You don't need to check if there is already a symlink, link-package does that for you.
But if you accidentally create an invalid symlink then trying to update by re-running your NPM task will fail with:
fs.js:945
return binding.symlink(preprocessSymlinkDestination(destination, type, path),
^
Error: EEXIST: file already exists, symlink '/path/to/my/link' -> '/Users/brianvaughn/Documents/git/td-console/node_modules/@myLink'
at Error (native)
at Object.fs.symlinkSync (fs.js:945:18)
at linkPackage (/Users/brianvaughn/Documents/git/td-console/node_modules/link-package/linkPackage.js:30:12)
at Object.<anonymous> (/Users/brianvaughn/Documents/git/td-console/node_modules/link-package/bin.js:3:28)
at Module._compile (module.js:425:26)
at Object.Module._extensions..js (module.js:432:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Function.Module.runMain (module.js:457:10)
at startup (node.js:136:18)
This currently requires a manual step:
rm ./node_modules/@myLink