2

I'm trying to use [email protected] on MacOs Sierra 10.12.5 Build works when I import only the web3-eth and web3-utils. When I import the whole web3 package then build fails with errors about swarm-js.

var Web3 = require('web3');

Output from npm run build :

WARNING in ./node_modules/web3/packages/web3-bzz/node_modules/mimetype/mimetype.js
18:5-12 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

ERROR in ./node_modules/web3/packages/web3-bzz/node_modules/swarm-js/lib/swarm.js
Module not found: Error: Can't resolve 'child_process' in '/Users/petro/ether/ucd-poc/node_modules/web3/packages/web3-bzz/node_modules/swarm-js/lib'
 @ ./node_modules/web3/packages/web3-bzz/node_modules/swarm-js/lib/swarm.js 373:19-48
 @ ./node_modules/web3/packages/web3-bzz/src/index.js
 @ ./node_modules/web3/src/index.js
 @ ./app/javascripts/app.jsx

ERROR in ./node_modules/web3/packages/web3-bzz/node_modules/swarm-js/lib/files.js
Module not found: Error: Can't resolve 'fs' in '/Users/petro/ether/ucd-poc/node_modules/web3/packages/web3-bzz/node_modules/swarm-js/lib'
 @ ./node_modules/web3/packages/web3-bzz/node_modules/swarm-js/lib/files.js 9:9-22
 @ ./node_modules/web3/packages/web3-bzz/node_modules/swarm-js/lib/swarm.js
 @ ./node_modules/web3/packages/web3-bzz/src/index.js
 @ ./node_modules/web3/src/index.js
 @ ./app/javascripts/app.jsx

ERROR in ./node_modules/web3/packages/web3-bzz/node_modules/swarm-js/lib/files.js
Module not found: Error: Can't resolve 'got' in '/Users/petro/ether/ucd-poc/node_modules/web3/packages/web3-bzz/node_modules/swarm-js/lib'
 @ ./node_modules/web3/packages/web3-bzz/node_modules/swarm-js/lib/files.js 11:10-24
 @ ./node_modules/web3/packages/web3-bzz/node_modules/swarm-js/lib/swarm.js
 @ ./node_modules/web3/packages/web3-bzz/src/index.js
 @ ./node_modules/web3/src/index.js
 @ ./app/javascripts/app.jsx

ERROR in ./node_modules/web3/packages/web3-bzz/node_modules/tar.gz/index.js
Module not found: Error: Can't resolve 'fs' in '/Users/petro/ether/ucd-poc/node_modules/web3/packages/web3-bzz/node_modules/tar.gz'
 @ ./node_modules/web3/packages/web3-bzz/node_modules/tar.gz/index.js 5:9-22
 @ ./node_modules/web3/packages/web3-bzz/node_modules/swarm-js/lib/files.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/swarm-js/lib/swarm.js
 @ ./node_modules/web3/packages/web3-bzz/src/index.js
 @ ./node_modules/web3/src/index.js
 @ ./app/javascripts/app.jsx

ERROR in ./node_modules/web3/packages/web3-bzz/node_modules/mz/fs.js
Module not found: Error: Can't resolve 'fs' in '/Users/petro/ether/ucd-poc/node_modules/web3/packages/web3-bzz/node_modules/mz'
 @ ./node_modules/web3/packages/web3-bzz/node_modules/mz/fs.js 7:7-20
 @ ./node_modules/web3/packages/web3-bzz/node_modules/fs-promise/index.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/swarm-js/lib/swarm.js
 @ ./node_modules/web3/packages/web3-bzz/src/index.js
 @ ./node_modules/web3/src/index.js
 @ ./app/javascripts/app.jsx

ERROR in ./node_modules/web3/packages/web3-bzz/node_modules/mkdirp/index.js
Module not found: Error: Can't resolve 'fs' in '/Users/petro/ether/ucd-poc/node_modules/web3/packages/web3-bzz/node_modules/mkdirp'
 @ ./node_modules/web3/packages/web3-bzz/node_modules/mkdirp/index.js 2:9-22
 @ ./node_modules/web3/packages/web3-bzz/node_modules/mkdirp-promise/lib/index.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/swarm-js/lib/files.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/swarm-js/lib/swarm.js
 @ ./node_modules/web3/packages/web3-bzz/src/index.js
 @ ./node_modules/web3/src/index.js
 @ ./app/javascripts/app.jsx

ERROR in ./node_modules/web3/packages/web3-bzz/node_modules/graceful-fs/graceful-fs.js
Module not found: Error: Can't resolve 'fs' in '/Users/petro/ether/ucd-poc/node_modules/web3/packages/web3-bzz/node_modules/graceful-fs'
 @ ./node_modules/web3/packages/web3-bzz/node_modules/graceful-fs/graceful-fs.js 1:9-22
 @ ./node_modules/web3/packages/web3-bzz/node_modules/mz/fs.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/fs-promise/index.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/swarm-js/lib/swarm.js
 @ ./node_modules/web3/packages/web3-bzz/src/index.js
 @ ./node_modules/web3/src/index.js
 @ ./app/javascripts/app.jsx

ERROR in ./node_modules/web3/packages/web3-bzz/node_modules/fstream/lib/proxy-writer.js
Module not found: Error: Can't resolve 'fs' in '/Users/petro/ether/ucd-poc/node_modules/web3/packages/web3-bzz/node_modules/fstream/lib'
 @ ./node_modules/web3/packages/web3-bzz/node_modules/fstream/lib/proxy-writer.js 14:9-22
 @ ./node_modules/web3/packages/web3-bzz/node_modules/fstream/fstream.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/tar.gz/index.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/swarm-js/lib/files.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/swarm-js/lib/swarm.js
 @ ./node_modules/web3/packages/web3-bzz/src/index.js
 @ ./node_modules/web3/src/index.js
 @ ./app/javascripts/app.jsx

ERROR in ./node_modules/web3/packages/web3-bzz/node_modules/fs-extra/lib/empty/index.js
Module not found: Error: Can't resolve 'fs' in '/Users/petro/ether/ucd-poc/node_modules/web3/packages/web3-bzz/node_modules/fs-extra/lib/empty'
 @ ./node_modules/web3/packages/web3-bzz/node_modules/fs-extra/lib/empty/index.js 3:11-24
 @ ./node_modules/web3/packages/web3-bzz/node_modules/fs-extra/lib/index.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/fs-promise/index.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/swarm-js/lib/swarm.js
 @ ./node_modules/web3/packages/web3-bzz/src/index.js
 @ ./node_modules/web3/src/index.js
 @ ./app/javascripts/app.jsx

ERROR in ./node_modules/web3/packages/web3-bzz/node_modules/graceful-fs/fs.js
Module not found: Error: Can't resolve 'fs' in '/Users/petro/ether/ucd-poc/node_modules/web3/packages/web3-bzz/node_modules/graceful-fs'
 @ ./node_modules/web3/packages/web3-bzz/node_modules/graceful-fs/fs.js 3:9-22
 @ ./node_modules/web3/packages/web3-bzz/node_modules/graceful-fs/graceful-fs.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/mz/fs.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/fs-promise/index.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/swarm-js/lib/swarm.js
 @ ./node_modules/web3/packages/web3-bzz/src/index.js
 @ ./node_modules/web3/src/index.js
 @ ./app/javascripts/app.jsx

ERROR in ./node_modules/web3/packages/web3-bzz/node_modules/rimraf/rimraf.js
Module not found: Error: Can't resolve 'fs' in '/Users/petro/ether/ucd-poc/node_modules/web3/packages/web3-bzz/node_modules/rimraf'
 @ ./node_modules/web3/packages/web3-bzz/node_modules/rimraf/rimraf.js 6:9-22
 @ ./node_modules/web3/packages/web3-bzz/node_modules/fstream/lib/writer.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/fstream/fstream.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/tar.gz/index.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/swarm-js/lib/files.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/swarm-js/lib/swarm.js
 @ ./node_modules/web3/packages/web3-bzz/src/index.js
 @ ./node_modules/web3/src/index.js
 @ ./app/javascripts/app.jsx

ERROR in ./node_modules/web3/packages/web3-bzz/node_modules/jsonfile/index.js
Module not found: Error: Can't resolve 'fs' in '/Users/petro/ether/ucd-poc/node_modules/web3/packages/web3-bzz/node_modules/jsonfile'
 @ ./node_modules/web3/packages/web3-bzz/node_modules/jsonfile/index.js 5:8-21
 @ ./node_modules/web3/packages/web3-bzz/node_modules/fs-extra/lib/json/jsonfile.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/fs-extra/lib/json/index.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/fs-extra/lib/index.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/fs-promise/index.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/swarm-js/lib/swarm.js
 @ ./node_modules/web3/packages/web3-bzz/src/index.js
 @ ./node_modules/web3/src/index.js
 @ ./app/javascripts/app.jsx

ERROR in ./node_modules/web3/packages/web3-bzz/node_modules/glob/glob.js
Module not found: Error: Can't resolve 'fs' in '/Users/petro/ether/ucd-poc/node_modules/web3/packages/web3-bzz/node_modules/glob'
 @ ./node_modules/web3/packages/web3-bzz/node_modules/glob/glob.js 43:9-22
 @ ./node_modules/web3/packages/web3-bzz/node_modules/rimraf/rimraf.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/fstream/lib/writer.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/fstream/fstream.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/tar.gz/index.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/swarm-js/lib/files.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/swarm-js/lib/swarm.js
 @ ./node_modules/web3/packages/web3-bzz/src/index.js
 @ ./node_modules/web3/src/index.js
 @ ./app/javascripts/app.jsx

ERROR in ./node_modules/web3/packages/web3-bzz/node_modules/glob/sync.js
Module not found: Error: Can't resolve 'fs' in '/Users/petro/ether/ucd-poc/node_modules/web3/packages/web3-bzz/node_modules/glob'
 @ ./node_modules/web3/packages/web3-bzz/node_modules/glob/sync.js 4:9-22
 @ ./node_modules/web3/packages/web3-bzz/node_modules/glob/glob.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/rimraf/rimraf.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/fstream/lib/writer.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/fstream/fstream.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/tar.gz/index.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/swarm-js/lib/files.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/swarm-js/lib/swarm.js
 @ ./node_modules/web3/packages/web3-bzz/src/index.js
 @ ./node_modules/web3/src/index.js
 @ ./app/javascripts/app.jsx

ERROR in ./node_modules/web3/packages/web3-bzz/node_modules/fs.realpath/index.js
Module not found: Error: Can't resolve 'fs' in '/Users/petro/ether/ucd-poc/node_modules/web3/packages/web3-bzz/node_modules/fs.realpath'
 @ ./node_modules/web3/packages/web3-bzz/node_modules/fs.realpath/index.js 8:9-22
 @ ./node_modules/web3/packages/web3-bzz/node_modules/glob/glob.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/rimraf/rimraf.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/fstream/lib/writer.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/fstream/fstream.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/tar.gz/index.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/swarm-js/lib/files.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/swarm-js/lib/swarm.js
 @ ./node_modules/web3/packages/web3-bzz/src/index.js
 @ ./node_modules/web3/src/index.js
 @ ./app/javascripts/app.jsx

ERROR in ./node_modules/web3/packages/web3-bzz/node_modules/fs.realpath/old.js
Module not found: Error: Can't resolve 'fs' in '/Users/petro/ether/ucd-poc/node_modules/web3/packages/web3-bzz/node_modules/fs.realpath'
 @ ./node_modules/web3/packages/web3-bzz/node_modules/fs.realpath/old.js 24:9-22
 @ ./node_modules/web3/packages/web3-bzz/node_modules/fs.realpath/index.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/glob/glob.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/rimraf/rimraf.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/fstream/lib/writer.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/fstream/fstream.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/tar.gz/index.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/swarm-js/lib/files.js
 @ ./node_modules/web3/packages/web3-bzz/node_modules/swarm-js/lib/swarm.js
 @ ./node_modules/web3/packages/web3-bzz/src/index.js
 @ ./node_modules/web3/src/index.js
 @ ./app/javascripts/app.jsx
2
  • this is on windows maybe? Check solutions with the 'fs' is a current fail error.
    – Gawey
    Jul 27, 2017 at 7:38
  • MacOS Sierra 10.12.5
    – szerte
    Jul 27, 2017 at 8:01

1 Answer 1

0

It works now with [email protected].

I assume the new beta version solved the issue but I also had two web3 npm installs: a local & global one. The global was 0.19.1 which I uninstalled.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.