Babel-loader: fileSystem.statSync is not a function

Created on 22 Aug 2017  Â·  20Comments  Â·  Source: babel/babel-loader

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

Most helpful comment

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

All 20 comments

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?

@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.

Sure:

$ npm ls webpack
/home/vagrant/src/project/site
└── [email protected]

$ npm ls enhanced-resolve
/home/vagrant/src/project/site
└─┬ [email protected]
  └── [email protected]

But when i $ npm ls --global i get:

/usr/lib
├─┬ [email protected]
  ...stuff...
└─┬ [email protected]

Because that's what i have specified.

So, ultimately, the issue seems to be that i'm using a deprecated version of webpack because i'm lazy. Not sure if there's anything for you to fix at this point.

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

@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

[email protected]
[email protected]

so I don't know why it still occur err

My temporarily solution is downgrade babel-loader to 7.1.1

yarn add [email protected] --dev

I had this problem when updating babel-eslint and babel-loader from version 6 to 7. On 6.* It still works OK.

I got this error with [email protected], downgrading babel-loader from 7.1.2 to 7.1.1 did the trick. Kudos to @JackyTung

@danez solve my problems tks

I had the same error with [email protected]. Downgraded babel-loader and it worked.

I downgraded to 7.1.1

On Fri, Dec 1, 2017 at 4:50 PM, Evan Sangaline notifications@github.com
wrote:

@spearson23 https://github.com/spearson23, which version of babel-loader
worked for you? I'm also using [email protected], but I still get the error
with all of the 6 and 7 babel-loader versions that I've tried.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/babel/babel-loader/issues/505#issuecomment-348623623,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABPm6ezp12b-7sYSLi60XUaHXMJZQsi1ks5s8HSwgaJpZM4O-wJ6
.

Had the same error, thanks for posting, its really helpful!

I encountered this error when i was using "babel-loader": "^7.1.3", Change to [email protected] worked!

I am facing the same issue in babel loader 6.2.5.
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) @ ./index.js 11:11-30 webpack: Failed to compile.

[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

I tried changing babel loader version to 7.1.1, but no luck.

@chosenvictim If you get that error it clearly indicates you are using babel-loader >= 7.0.0 (and not 6.2.5) with webpack 1. Maybe you can check your node modules , package.json or lock file.

The line the error is thrown does not exist in babel-loader 6.x.

Worked when I installed babel-loader 6.3. I'm using webpack 1.13.3

@danez I am pretty sure that I am using babel-loader 6.2.5 and webpack 1.15.0
I checked with npm ls --depth=0

I have the same issue with webpack 4.1.12 and babel-loader 7.1.4. The only solution for is to modify the code not to use the cache version. Would be better to have a fix.
Thanks

As mentioned, this should only be happening if you're running with a very old Webpack version. If you run into this issue, make sure you're actually using your local node_modules webpack install, not a globally-installed one that might be much older.

babel-loader 8.0.4
webpack 4.19.0

Facing same issue. I thought 4.x was compatible with 8.x ? I can't downgrade major versioning as it will break multiple projects, so is there a specific version between 8 and 4 that works? @danez

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ozee31 picture ozee31  Â·  24Comments

adamziel picture adamziel  Â·  73Comments

LuckyPigeon picture LuckyPigeon  Â·  16Comments

acnovais picture acnovais  Â·  72Comments

tusharmath picture tusharmath  Â·  55Comments