web3c.js icon indicating copy to clipboard operation
web3c.js copied to clipboard

Module not found: Error: Can't resolve 'websocket' in web3c.js/node_modules/web3-providers-ws/src

Open marsrobertson opened this issue 6 years ago • 3 comments

  • git clone
  • npm install
  • npm run-script build
> [email protected] build /Users/zen/Code/web3c.js
> webpack-command --entry ./index.browser.js --output output/web3c.js

ℹ 「webpack」: Starting Build
ℹ 「webpack」: Build Finished

webpack v4.26.0

f426ec53caa9eb018dd4
 size     name  module                            status
 202 B    2     ./index.browser.js                built
 1.88 kB  3     ./web3c/index.js                  built
 3.54 kB  4     ./web3c/confidential.js           built
 8.42 kB  5     ./web3c/confidential_provider.js  built
 7.29 kB  6     ./web3c/key_manager.js            built
 15 B     7     crypto (ignored)                  built
 1.21 kB  8     ./crypto/subtle/mrae_box.js       built
 3.48 kB  9     ./crypto/subtle/siv_ctr.js        built
 489 B    14    (webpack)/buildin/global.js       built
 497 B    24    (webpack)/buildin/module.js       built
 15 B     149   util (ignored)                    built
 15 B     151   util (ignored)                    built
 15 B     176   buffer (ignored)                  optional built
 15 B     221   crypto (ignored)                  optional built

 Δt 4594ms (6 assets, 281 modules hidden)


./node_modules/web3-providers-ws/src/index.js
 0:0  error  Module not found: Error: Can't resolve 'websocket' in
             '/Users/zen/Code/web3c.js/node_modules/web3-providers-ws/src'

✖ 1 problem (1 error, 0 warnings)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `webpack-command --entry ./index.browser.js --output output/web3c.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.```

marsrobertson avatar Dec 15 '18 12:12 marsrobertson

it looks like the issue here is that websocket failed to build during npm install.

I see

[email protected][email protected] (git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2)

the websocket module does have a native code component that needs to compile with node-gyp:

> [email protected] install ~/web3c/node_modules/websocket
> (node-gyp rebuild 2> builderror.log) || (exit 0)

  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
  SOLINK_MODULE(target) Release/bufferutil.node
  CXX(target) Release/obj.target/validation/src/validation.o
  SOLINK_MODULE(target) Release/validation.node

Do you see errors there?

willscott avatar Dec 17 '18 19:12 willscott

My issue got resolved when I installed new version of web3

jainsuchita avatar Apr 25 '19 16:04 jainsuchita

@willscott see issue https://github.com/ethereum/web3.js/issues/2863#issuecomment-503624214 and associated commit https://github.com/ethereum/web3.js/commit/b27eff44920d4776b07c19db7f42ec518796ee46 for the fix. Upgrading the following web3 dependency to v1.0.0-beta.52 or higher should resolve this issue. https://github.com/oasislabs/web3c.js/blob/542571404fcb2ce23a0fe01109106bcd207c1a6d/package.json#L51

mjgallag avatar Aug 14 '19 16:08 mjgallag