Skip to content

Instantly share code, notes, and snippets.

@sheljohn
Last active September 4, 2017 10:27
Show Gist options
  • Save sheljohn/6021e522397603ed90df87a9157f4728 to your computer and use it in GitHub Desktop.
Save sheljohn/6021e522397603ed90df87a9157f4728 to your computer and use it in GitHub Desktop.
Webpack fails to build on NTFS filesystems
#!/bin/bash
# create temporary directory and move to it
FOLDER=$(mktemp -d)
echo "Moving to folder $FOLDER"
cd $FOLDER
# create a 50M file
FILE=test.ntfs
echo "Creating empty file $FILE"
dd if=/dev/zero of="$FILE" bs=1M count=50
# find available loop device
LOOPDEV=$(losetup -f)
echo "The following loop-device will be used: $LOOPDEV"
# format the file
FORMAT=ntfs
echo "Formatting file $FILE as ${FORMAT}-filesystem (requires sudo)."
sudo losetup $LOOPDEV "$FILE"
# attach device
sudo mkfs -t $FORMAT $LOOPDEV
# format image
sudo losetup -d $LOOPDEV
# detach device
# mount the file
MOUNTPOINT=test
mkdir $MOUNTPOINT
echo "Mounting formatted image $FILE onto folder $MOUNTPOINT (requires sudo)."
sudo mount -t $FORMAT -o loop $FILE $MOUNTPOINT
cd $MOUNTPOINT
# move into the image, and try to build webpack
echo "Initialising NPM and installing Webpack..."
npm init -yf
npm i webpack
# This fails with:
# npm ERR! code ENOTEMPTY
# npm ERR! errno -39
# npm ERR! syscall rmdir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment