Web3.js: pathological npm install behavior re: web3-providers-ws

Created on 3 Sep 2018  ยท  13Comments  ยท  Source: ChainSafe/web3.js

I'm experiencing "weird things" related to:

https://github.com/ethereum/web3.js/blob/v1.0.0-beta.35/packages/web3-providers-ws/package.json#L12

In a project that specifies "web3": "1.0.0-beta.35" in its package.json, with a fresh install (rm -rf node_modules && npm i .) there's some package-lock churn and then npm ls | less reveals this:

โ”‚ โ”‚ โ”‚ โ””โ”€โ”ฌ [email protected]
โ”‚ โ”‚ โ”‚   โ”œโ”€โ”€ [email protected]
โ”‚ โ”‚ โ”‚   โ”œโ”€โ”€ [email protected] deduped
โ”‚ โ”‚ โ”‚   โ””โ”€โ”ฌ [email protected] invalid (git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2)
โ”‚ โ”‚ โ”‚     โ”œโ”€โ”€ [email protected] extraneous
โ”‚ โ”‚ โ”‚     โ”œโ”€โ”€ [email protected] deduped
โ”‚ โ”‚ โ”‚     โ”œโ”€โ”€ UNMET DEPENDENCY typedarray-to-buffer@^3.1.2
โ”‚ โ”‚ โ”‚     โ””โ”€โ”€ UNMET DEPENDENCY yaeti@^0.0.6

typedarray-to-buffer is, after install, definitely missing, and sometimes websocket is missing as well. In other words, the installation is broken.

I can "fix" it by doing: npm un web3 && npm i --save-exact [email protected]. There's more package-lock churn and the missing deps are no longer missing. But then with a fresh install (e.g. on travis or appveyor), I'm back where I started.

node: 8.11.4
npm: 6.4.1
platforms affected: macOS, Linux, Windows.

bug

Most helpful comment

thanks for the update @nivida ! Keep the good work. Bug still present in beta.37

All 13 comments

This should be fixed via #1907 but has not been released yet.

@daffl good to hear. Any ETA on the next version?

Also, when it does land, perhaps it would be good to deprecate all affected versions of web3 โ€” beta.35, beta.36, others?

@michaelsbradleyjr

I have a vanilla install of create-react-app, and tried adding a specific reference to "web3": "1.0.0-beta.35" in dependencies. When i generate a package-lock.json via npm install under npm versions 5.10.0, 6.2.0, 6.4.1, i get the following error in my build:

Module not found: Error: Can't resolve 'websocket' in '/home/circleci/dex_terminal_evan/node_modules/web3-providers-ws/src'

Alternatively, generating a package-lock.json under npm version 5.6.0, the build passes. It also builds fine when I run install without a package-lock.json.

I'm not sure what the connection is between this and #1907, @daffl can you elaborate?

This should be solved in the next build.

Any chance you release the fixed version any soon? Having a simple fix for an annoying bug, and not releasing it for two months, doesn't look like a good dev practice, even if we talk about a beta version.

@birdofpreyru Yeah I know it should be released next month. Sorry for the long outstanding release but I have to clean up a lot of things before I can really maintain/fixing this lib.

thanks for the update @nivida ! Keep the good work. Bug still present in beta.37

For me it works fine on Mac, but it's failing on our build machines (Linux).
This is started like a week ago

@leonprou Same for me, failing on Heroku and works on Mac. Did you managed to fix it ?

@kolya182 yeah, I added the missing dependency to my package.json as a temporary solution. for me it was websocket package.

@leonprou Thanks
Temp fix for me npm i --save websocket

"node": 10.15.0,
"npm": 6.4.1

I just ran npm install and it worked for me.

Should be fixed with the PR #2000.
Feel free to test it with the git tag: https://github.com/ethereum/web3.js/tree/v1.0.0-beta.38-rc2

Was this page helpful?
0 / 5 - 0 ratings

Related issues

connectdotz picture connectdotz  ยท  3Comments

dhl picture dhl  ยท  3Comments

nivida picture nivida  ยท  3Comments

sundbry picture sundbry  ยท  3Comments

webersson picture webersson  ยท  3Comments