2

Issue:

I just updated my WSL installation after installing the Fall Creators Update and now when I run npm i I get the following warnings from npm I get probably 2-20 of these warnings from random packages each time I install, it's never consistent. Sometimes it even works, no warnings. I thought that this might be okay, but when I run my project npm run dev I get all sorts of errors. It seems to me that the packages aren't installing correctly. But on the occasion when it doesn't show warnings the application runs as expected. I tested with some random projects from GitHub and same issue.

Versions:

  • NPM Version: 5.5.1
  • NodeJS Version: 8.9.0
  • Other Factors: ZSH

ERROR:

npm WARN tar EINVAL: invalid argument, open '/mnt/c/Users/Me/Documents/project/node_modules/.staging/parse-json-07a114c7/index.js'

npm WARN tar EINVAL: invalid argument, open '/mnt/c/Users/Me/Documents/Project/node_modules/.staging/esrecurse-fe2bc2eb/package.json'

Notes:

  • Tried a fresh install of WSL, same issue
  • can install globally without issue, only seems to fail in the /mnt/** path.
  • Can confirm it works in the Linux folders, successful installation in home directory, but breaks on /mnt/**

EDIT: After much troubleshooting I decided to run without ZSH and switching back to using bash.exe instead of the suggested wsl.exe. First install worked. Testing further.

Auzy
  • 2,135
  • 2
  • 25
  • 35

1 Answers1

3

The issue was in fact with the Fall Creators Update. Many optimizations were made and it seems that something to do with symlinking mounted drives had issues. See all the technical conversation here

There are two solutions, first and recommended, the WSL team has already fixed and the fix is in Insiders Build 17035. This fix requires going to Settings -> Insiders -> Selecting "get Active Builds" and then "Fast Ring". Only do this if you are experienced in dealing with occasional breaks as it is essentially beta software.

Fix number two and recommended if you can't update or don't feel comfortable with Insiders Builds is to add this to your .bashrc file:

if ! mount | grep -q "C: on /mnt/c type drvfs (rw,noatime,fallback=1)"; then
    echo "== Remount of C: drive required =="
    pushd ~ > /dev/null
    sudo umount /mnt/c
    sudo mount -t drvfs -o noatime,fallback=1 C: /mnt/c
    popd > /dev/null
fi

The .bashrc solution does remove many performance gains however so only do if really necessary.

Auzy
  • 2,135
  • 2
  • 25
  • 35