New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webpack throw erorr about 'fs' module #9

Closed
asfktz opened this Issue Nov 30, 2014 · 6 comments

Comments

Projects
None yet
6 participants
@asfktz

asfktz commented Nov 30, 2014

while building with webpack, I'm getting this error:

ERROR in ./~/valuable/~/lazy.js/lazy.node.js
Module not found: Error: Cannot resolve module 'fs' 
  in /Users/asafkatz/Documents/dev/react-cart/node_modules/valuable/node_modules/lazy.js
@ ./~/valuable/~/lazy.js/lazy.node.js 1:13-26

it happens even if I just call:

var Valuable = require('valuable');

using the latest version: 0.3.2

for what its worth, this is my webpack.config.js file

// webpack.config.js
module.exports = {
    entry: './app/app.jsx',
    output: {
        path : './app',
        filename: 'bundle.js',
    },
    cache : true,
    watch : true,
    devtool: "eval",
    module: {
        loaders: [
            {
                test: /\.jsx$/,
                loader: 'jsx-loader?harmony'
            }
        ]
    },
    resolve : {
        extensions : ['', '.js', '.jsx']
    }
};

@josephsavona

This comment has been minimized.

Owner

josephsavona commented Nov 30, 2014

Seems similar to pugjs/pug-loader#8 (comment) - try adding

node: {
  fs: "empty"
}

to your webpack config

@amypellegrini

This comment has been minimized.

amypellegrini commented Oct 31, 2016

I had this problem with webpack, but I solved adding:

target: 'node',

to my webpack.config.js as described here

@tbogatchev

This comment has been minimized.

tbogatchev commented May 25, 2017

I'm still receiving the fs module error after adding target: 'node' and node: {fs: 'empty'}, any other ideas?
Running node 7.9.0
Webpack 2.3.3

@josephsavona

This comment has been minimized.

Owner

josephsavona commented May 25, 2017

I'm no longer maintaining this repository. I'd suggest alternate approaches to state management - Redux is great, I'm less familiar w Mobx but it is conceptually closer to valuable.

@amedley

This comment has been minimized.

amedley commented Jul 7, 2017

Don't target: 'node' AND node: {fs: 'empty'}
Only target: 'node', do not do both.

thorncp added a commit to davidimoore/rails_4_react_sandbox that referenced this issue Sep 6, 2017

Handle Can't resolve 'fs' error
For an unknown reason, Webpack fails to compile on my machine, saying
'fs' can't be resolved. [Several][1], [people][2], [have said][3]
setting `{ node: { fs: "empty" } }` in the Webpack config fixes the
issues, but I haven't found an explanation as to why.

This updates the environment.js file to serve as a common place to
configure all environments, and adds the previously mentioned config.

[1]: josephsavona/valuable#9 (comment)
[2]: webpack-contrib/css-loader#447 (comment)
[3]: rails/webpacker#608 (comment)
@vurumadla

This comment has been minimized.

vurumadla commented Oct 13, 2017

i am facing this issue during building through dev.js. can anyone sugegst the solution.

WARNING in .//ipfs-js//ipfs-api/dist/ipfsapi.min.js
Critical dependencies:
1:461-468 This seems to be a pre-built javascript file. Though this is possible, it's not recommended. Try to require the original source to get better results.
@ .//ipfs-js//ipfs-api/dist/ipfsapi.min.js 1:461-468

ERROR in .//ipfs-api/lib/get-files-stream.js
Module not found: Error: Cannot resolve module 'fs' in /home/centos/PrivateSecurities1/node_modules/ipfs-api/lib
@ ./
/ipfs-api/lib/get-files-stream.js 33:11-24

ERROR in .//glob/glob.js
Module not found: Error: Cannot resolve module 'fs' in /home/centos/PrivateSecurities1/node_modules/glob
@ ./
/glob/glob.js 43:9-22

ERROR in .//glob/sync.js
Module not found: Error: Cannot resolve module 'fs' in /home/centos/PrivateSecurities1/node_modules/glob
@ ./
/glob/sync.js 4:9-22

ERROR in .//ipfs-merkle-dag/lib/dag-node.js
Module not found: Error: Cannot resolve module 'fs' in /home/centos/PrivateSecurities1/node_modules/ipfs-merkle-dag/lib
@ ./
/ipfs-merkle-dag/lib/dag-node.js 9:9-22

ERROR in .//fs.realpath/index.js
Module not found: Error: Cannot resolve module 'fs' in /home/centos/PrivateSecurities1/node_modules/fs.realpath
@ ./
/fs.realpath/index.js 8:9-22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment