npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

FAT file system drives cause `npm install` to fail if packages are being updated

What I Wanted to Do

  1. Run npm install to create and fill node_modules directory
  2. Update a package version in package.json file
  3. Run npm install

What Happened Instead

Install failed with:

1167 verbose stack Error: EINVAL: invalid argument, read
1167 verbose stack     at C:\Users\murrp\AppData\Roaming\npm\node_modules\npm\node_modules\gentle-fs\lib\rm.js:245:7
1167 verbose stack     at C:\Users\murrp\AppData\Roaming\npm\node_modules\npm\node_modules\gentle-fs\node_modules\iferr\index.js:13:50
1167 verbose stack     at C:\Users\murrp\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:285:20
1167 verbose stack     at FSReqWrap.oncomplete (fs.js:155:5)
1168 verbose cwd D:\Documents\workspace\\rss_temple_http\rss-temple
1169 verbose Windows_NT 10.0.17763
1170 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\murrp\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "i"
1171 verbose node v10.14.2
1172 verbose npm  v6.6.0
1173 error code EINVAL
1174 error EINVAL: invalid argument, read
1175 verbose exit [ 1, true ]

Reproduction Steps

The most important detail to reproduce is your repo should be stored on a drive formatted with exFAT. FAT32 drives are likely also affected, but I could not test on my setup.


A known workaround is to move your repo onto a drive formatted with an FS that supports soft links (like NTFS or the various Linux FS’s), and run npm install there instead.

The error seems to be generated in the gentle-fs package (particularly the _readLinkOrShim method), but my debugging efforts have been unsuccessful in determining if there error should be handled there or by the calling function. My best guess is that the calling function assumes the path points to a soft link, but FAT FS’s do not support soft links.

The use-case being covered here is for developers that keep their repos on an external or USB drive.

Further discussion:

2019-01-22T22_05_00_482Z-debug.log (255.5 KB)

Platform Info

$ npm --versions
{ npm: '6.6.0',
  ares: '1.15.0',
  cldr: '33.1',
  http_parser: '2.8.0',
  icu: '62.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.34.0',
  node: '10.14.2',
  openssl: '1.1.0j',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.23.2',
  v8: '',
  zlib: '1.2.11' }
$ node -p process.platform