babel-loader: fileSystem.statSync is not a function

Getting this error only on v7.1.2. When I downgrade to 7.1.1 - everything works.

Module build failed: TypeError: fileSystem.statSync is not a function
    at module.exports (.../node_modules/babel-loader/lib/utils/exists.js:7:25)
    at find (.../node_modules/babel-loader/lib/resolve-rc.js:13:9)
    at Object.module.exports (.../node_modules/babel-loader/lib/index.js:113:132)

Host node v8.1.2 Electron version is 1.7.5 webpack 3.5.5

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 47
  • Comments: 20 (4 by maintainers)

Commits related to this issue

Most upvoted comments

if you use webpack 1.x please use babel-loader 6.x

My temporarily solution is downgrade babel-loader to 7.1.1

yarn add babel-loader@7.1.1 --dev

I had the same error with webpack@3.9.1. Downgraded babel-loader and it worked.

I got this error with webpack@2.4.1, downgrading babel-loader from 7.1.2 to 7.1.1 did the trick. Kudos to @JackyTung

@vshymanskyy @joboscribe can you post the output of the following commands from within your project:

npm ls webpack
npm ls enhanced-resolve

this.fs is the cached filesystem from webpack and it should support statSync since version 2.2.0 of webpack.

Looks like in lib/index.js

var fileSystem = this.fs ? this.fs : fs;

this.fs exists but doesn’t have the function statSync. When i changed it to

var fileSystem = fs;

everything seemed to work. What’s the goal in using this.fs? I didn’t dig very far, does it allow for overriding it to something other than fs?

I encountered this error when i was using “babel-loader”: “^7.1.3”, Change to babel-loader@6.2.5 worked!

@danez I also encounter same error msg, I write the comment under this issue https://github.com/babel/babel-loader/issues/503#issuecomment-324251487

my package version is

babel-loader@7.1.2
webpack@2.7.0

so I don’t know why it still occur err