Web3.js: Where is `dist` folder and `web3.min.js`?

Created on 14 Sep 2017  路  30Comments  路  Source: ChainSafe/web3.js

After npm install --save web3, I only see packages and src foldesr inside node_modules/web3. Where is the dist folder containing web3.min.js?

more information needed

Most helpful comment

@nyxynyx hey so basically along with npm install web3 you also need "npm install ethereum/web3.js" . This worked for me

All 30 comments

Same issue here when installing with npm. No dist folder. Thought I'd try npm run build, but there's an error: "Local gulp not found in ...". While I do have gulp installed globally.

I should add that using import Web3 from 'web3' (in Nuxt.js) gives an error for missing dependencies:

These dependencies were not found:

* eth-lib/lib/hash in ./node_modules/web3/packages/web3-utils/src/utils.js
* ethjs-unit in ./node_modules/web3/packages/web3-utils/src/index.js
* number-to-bn in ./node_modules/web3/packages/web3-utils/src/utils.js
* randomhex in ./node_modules/web3/packages/web3-utils/src/index.js
* swarm-js in ./node_modules/web3/packages/web3-bzz/src/index.js
* underscore in ./node_modules/web3/packages/web3-bzz/src/index.js, ./node_modules/web3/packages/web3-eth/src/index.js and 4 others
* web3-core in ./node_modules/web3/packages/web3-eth-personal/src/index.js, ./node_modules/web3/packages/web3-eth/src/index.js and 2 others
* web3-core-helpers in ./node_modules/web3/packages/web3-core/src/extend.js, ./node_modules/web3/packages/web3-eth-personal/src/index.js and 1 other
* web3-core-method in ./node_modules/web3/packages/web3-core/src/extend.js, ./node_modules/web3/packages/web3-eth-personal/src/index.js and 3 others
* web3-core-requestmanager in ./node_modules/web3/packages/web3-core/src/index.js
* web3-core-subscriptions in ./node_modules/web3/packages/web3-eth/src/index.js, ./node_modules/web3/packages/web3-shh/src/index.js
* web3-eth-abi in ./node_modules/web3/packages/web3-eth/src/index.js
* web3-eth-accounts in ./node_modules/web3/packages/web3-eth/src/index.js
* web3-eth-contract in ./node_modules/web3/packages/web3-eth/src/index.js
* web3-eth-iban in ./node_modules/web3/packages/web3-eth/src/index.js
* web3-eth-personal in ./node_modules/web3/packages/web3-eth/src/index.js
* web3-net in ./node_modules/web3/packages/web3-eth-personal/src/index.js, ./node_modules/web3/packages/web3-eth/src/index.js and 1 other
* web3-utils in ./node_modules/web3/packages/web3-core/src/extend.js, ./node_modules/web3/packages/web3-eth-personal/src/index.js and 2 others

To install them, you can run: npm install --save eth-lib/lib/hash ethjs-unit number-to-bn randomhex swarm-js underscore web3-core web3-core-helpers web3-core-method web3-core-requestmanager web3-core-subscriptions web3-eth-abi web3-eth-accounts web3-eth-contract web3-eth-iban web3-eth-personal web3-net web3-utils

@riteable npm run-script build should work. And why is it not installing those dependencies? They are in the package.json and testing it locally works. Can you give more information?

I also have this issue: no dist folder after running npm install web3 --save.

My mac has node v8.5.0 and npm v5.4.2.

Thanks in advance for any insight!

after running npm install [email protected] --save i'm missing utils functions.

i went into /node_modules/web3/ and ran npm install and npm run-script build but i get the install error:
Error: Cannot find module 'web3-core' from '[my_project_path]/node_modules/web3/packages/web3-net/src'

@frozeman Now it seems to install even less files than previously. When I npm install web3 and view my node_modules/web3 directory there's only a src directory, and package.json and README.md files. I assume there should be a lot more there, like dist, packages, lib directories, etc.

Also, package.json doesn't have a scripts field where the build command is defined, so npm run-script build will not work inside the web3 directory.

This happens using OS X and [email protected]. Later today I will test on Ubuntu and report back.

Same problem here

I am facing the same issue on Ubuntu. Has anyone figured out the solution?

@nyxynyx hey so basically along with npm install web3 you also need "npm install ethereum/web3.js" . This worked for me

If you wanna create the dist/web3.js you'll have to do this directly from the source code.

git clone [email protected]:ethereum/web3.js
git checkout 1.0
npm install
npm run-script build

What worked for me.
If web.0.x.x ,
import 'web3/index'

hi guys i solved this issue by downloading the offline package from https://codeload.github.com/ethereum/web3.js/zip/develop and unzipped dist part from it and moved it to the directory where web3 was installed and added where it must be .

Just discovered tag 1.0. Here is always actual latest dist: https://github.com/ethereum/web3.js/blob/1.0/dist/web3.min.js

Since web3 1.x package is published via packages/web3 and dist/ is not there.
I made a patch at https://github.com/ethereum/web3.js/pull/1336 to put the dist/web3.min.js to the right place.

@k06a Thanks so much. It was really difficult to find the 1.0 version

I have this problem. >:(

The dist folder is in the 1.0 branch: https://github.com/ethereum/web3.js/tree/1.0/dist

still have this problem, isn't there any alternative to web3 to work with Ethereum?!?!

Of coursce if you need 1.x.x version just use /dist/web3.esm.js, minify it use Free Online Javascript Minifier

still have this problem, isn't there any alternative to web3 to work with Ethereum?!?!

Use this library ethers.js, wrapper for web3

npm install [email protected] --save
this works for me :))

npm install ethereum/web3.js did work for me (I get a distfolder with web3.min.js) - NOT npm install web3

I tried npm install ethereum/web3.js and did NOT get a dist folder with web3.min.js... the links above with the online version of this file are all 404ing

[email protected] --save

Thanks! This works for me too!

Because this is the old web3 version. So read the Javascript API document instead of web3 official website

Why isn't the dist folder with the most up to date web3.js file just added here? It makes it really hard to understand what's wrong and where to find the right files needed.

[email protected] --save

Thanks! This works for me too!

I also found another solution for installing web3js 1.0.0 by following those command :

  1. uninstall / reinstall node (deleted all related folders in local directories too, including in Roaming)
  2. in POWERSHELL as Administrator: npm install --global --production windows-build-tools
  3. npm install --save --no-optional web3.

Hope this help you catch up with the lastest version of web3.

I'm having this problem, nothing mentioned here has helped me get a web3.min.js.

@1559012
Your solution really helps. In my case, in Windows 10, nothing worked until I UNINSTALL the nodes first:
npm uninstall -g web3

Then

install the build tools and reinstall web3 as in steps 2. and 3. @1559012
Thank you so much!

Was this page helpful?
0 / 5 - 0 ratings