npm 5 and file: URLs

mkdir experiment-1
cd experiment-1
mkdir package-parent
mkdir package-child
cd package-child
npm init -f
cd ../package-parent
npm init -f
npm i --save ../package-child
ls -l node_modules
drwxr-xr-x  3 alex  wheel  102  6 Jul 11:03 package-child
lrwxr-xr-x  1 alex  wheel  19  6 Jul 10:56 package-child -> ../../package-child
  • npm now symlinks file: specifiers
  • npm calls file: URLs “specifiers”, which is telling because the behaviour is different to URLs (link instead of copy)
  • We probably should be using link: instead of file:, but the documentation isn’t clear enough yet (are GitHub issues documentation)
  • If you can’t use symlinks, or if they upset your build tools, then try using tarballs instead
  • When you’re trying to figure out npm issues, use --verbase. The CLI does that Unix thing of being quiet after running, which means the results of an action aren’t always clear



Software critic.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store