npm install fails on FAT32 sile system

2019-09-20 07:44发布

问题:

I'm trying to run npm install in a folder on my FAT32 drive, and this is the error I'm getting:

$ npm install
/work/sites/project
└── (empty)

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.15: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! Linux 4.8.0-27-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! node v6.9.1
npm ERR! npm  v3.10.8
npm ERR! path ../semver/bin/semver
npm ERR! code EPERM
npm ERR! errno -1
npm ERR! syscall symlink

npm ERR! Error: EPERM: operation not permitted, symlink '../semver/bin/semver' -> '/work/sites/project/node_modules/accord/node_modules/.bin/semver'
npm ERR!     at Error (native)
npm ERR!  { Error: EPERM: operation not permitted, symlink '../semver/bin/semver' -> '/work/sites/project/node_modules/accord/node_modules/.bin/semver'
npm ERR!     at Error (native)
npm ERR!   errno: -1,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'symlink',
npm ERR!   path: '../semver/bin/semver',
npm ERR!   dest: '/work/sites/project/node_modules/accord/node_modules/.bin/semver',
npm ERR!   parent: 'accord' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /work/sites/project/npm-debug.log
npm ERR! code 1
$

So far I understand that the problem is caused by FAT32 not supporting symlinks and/or chmod. But is it really true that there's no work-around for this?

There is an issue open for this on GitHub, where maintainers agree that this is a bug and should be fixed, but the thread has been idle for over a year now.

Also in the same thread user mgiorgino mentions that npm install run under Windows does not make this error. I don't have a chance to confirm this, so is there anyone on Windows who was able to successfully run npm install on a FAT32 file system? If yes, is there any way that we get the same functionality under Linux?

Finally, looking around the web I found FAT32 file system driver and FAT16/FAT32 filesystem implementation packages. Since both their documentation is very scarce, so I can't tell if they can help fix this problem?

回答1:

Try updating npm by running npm install npm@latest -g. I ran that command and it updated to v4.0.2. The recent updates could contain a fix if it is code related. Command in footer of the npm docs page.

Disabling symlinks helped a number of users when using npm install on systems unable to create symlinks. To turn off npm using symlinks set bin-links to false in the npm config by running npm config set bin-links false. Optionally you can run npm install --no-bin-links each time. The first command makes the change to the npm config so you don't have to add the --no-bin-links flag each time you run npm install. This is the method recommended in the npm config docs to get npm working on systems/drives that don't support symlinks.