Skip to content
Advertisement

Error: EXDEV: cross-device link not permitted, rename

There are many question similar to my question on stack overflow. However not solved my problem.

I am getting this error on Ubuntu 18.04:

Error: EXDEV: cross-device link not permitted, rename ‘/tmp/upload_df97d265c452c510805679f968bb4c17’ -> ‘/home/haider/workspaceNode/DSC_0076.JPG’

I Tried This code

JavaScript

Advertisement

Answer

I suppose that Node’s fs.rename cannot rename across filesystems (that is, limited to link/unlink within one filesystem).

Wherever your /home is, it’s a safe bet to suppose that /tmp is a tmpfs filesystem actually residing in memory. (You can check in the output of mount.)

So, to move a file, you have to fs.copyFile your data to the destination, then fs.unlink the original downloaded file.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement