Search code examples
reactjsbabel-loader

Module build failed: TypeError: fileSystem.statSync is not a function


trying to run a reactjs application , but I am getting this error

Module build failed: TypeError: fileSystem.statSync is not a function

My package.json file looks like this

{
  "name": "stellar-laboratory",
  "version": "0.0.1",
  "private": true,
  "description": "",
  "author": "Stellar Development Foundation <[email protected]>",
  "license": "Apache-2.0",
  "scripts": {
    "start": "gulp develop",
    "build": "gulp build"
  },
  "dependencies": {
    "@ledgerhq/hw-app-str": "^4.14.0",
    "@ledgerhq/hw-transport-u2f": "^4.13.0",
    "axios": "^0.8.1",
    "babel-loader": "^7.1.5",
    "babel-preset-stage-2": "^6.24.1",
    "babel-core": "^6.0.20",
    "babel-plugin-transform-runtime": "^6.23.0",
    "babel-polyfill": "^6.0.16",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-stage-0": "^6.0.15",
    "bluebird": "^3.5.1",
    "browser-sync": "^2.9.11",
    "chai": "^3.5.0",
    "classnames": "^2.2.0",
    "css-loader": "^0.18.0",
    "extract-text-webpack-plugin": "^0.8.2",
    "file-loader": "^0.8.4",
    "gulp": "^3.9.0",
    "gulp-mocha": "^2.2.0",
    "html-webpack-plugin": "^1.6.2",
    "json-loader": "^0.5.3",
    "lodash": "^4.17.5",
    "mocha": "^2.4.5",
    "node-sass": "^4.7.2",
    "react": "^0.14.0",
    "react-dom": "^0.14.0",
    "react-redux": "^4.0.0",
    "redux": "^3.0.4",
    "redux-thunk": "^1.0.0",
    "route-recognizer": "^0.1.9",
    "sass-loader": "^3.2.3",
    "solar-css": "git+https://github.com/stellar/solar#master",
    "solar-stellarorg": "git+https://github.com/stellar/solar-stellarorg#master",
    "stellar-sdk": "^0.11.0",
    "uri-templates": "^0.1.9",
    "urijs": "^1.16.0",
    "webpack": "^1.13.2"
  }
}

Update

Then I downgraded my babel-loader to ^7.1.1

**post to that I am gettting this error

Module build failed: SyntaxError: Unexpected token (42:2)

app.js

require("./styles/main.scss");

import React from 'react';
import ReactDOM from 'react-dom';
import {createStore, applyMiddleware} from 'redux';
import thunk from 'redux-thunk';
import {Provider} from 'react-redux';
import {throttle} from 'lodash';

import rootReducer from './reducers/root';
import logging from './middleware/logging';
import {routerMiddleware} from './utilities/simpleRouter';
import LaboratoryChrome from './components/LaboratoryChrome';
import {loadState, saveState}  from './localStorage';

const persistedState = loadState();

import StellarSdk from 'stellar-sdk';

if (typeof window !== "undefined") {
  window.StellarSdk = StellarSdk;
}

document.write('<div id="app"></div>');


let createStoreWithMiddleware = applyMiddleware(
  thunk,
  routerMiddleware,
  logging
)(createStore);

let store = createStoreWithMiddleware(rootReducer, persistedState);

store.subscribe(throttle(() => {
  saveState({
    network: store.getState().network
  });
}, 1000));

ReactDOM.render(
  <Provider store={store}>
    <LaboratoryChrome />
  </Provider>,
  document.getElementById('app')
);

Solution

  • Fixed it by just using Yarn instead