After update angular and rxjs to v6
ng build
WARNING in ./node_modules/asn1.js/lib/asn1/api.js
Module not found: Error: Can't resolve 'vm' in '**\toh-pt6\node_modules\asn1.js\lib\asn1'
ERROR in ./node_modules/eth-lib/lib/bytes.js
Module not found: Error: Can't resolve 'crypto' in '*\toh-pt6\node_modules\eth-lib\lib'
ERROR in ./node_modules/web3-eth-accounts/node_modules/eth-lib/lib/bytes.js
Module not found: Error: Can't resolve 'crypto' in '\toh-pt6\node_modules\web3-eth-accounts\node_modules\eth-lib\lib'
ERROR in ./node_modules/web3-eth-accounts/src/index.js
Module not found: Error: Can't resolve 'crypto' in '\toh-pt6\node_modules\web3-eth-accountssrc'
ERROR in ./node_modules/browserify-sign/browser/index.js
Module not found: Error: Can't resolve 'stream' in '\toh-pt6\node_modules\browserify-sign\browser'
ERROR in ./node_modules/cipher-base/index.js
Module not found: Error: Can't resolve 'stream' in '\toh-pt6\node_modules\cipher-base'
ERROR in ./node_modules/hash-base/index.js
Module not found: Error: Can't resolve 'stream' in '*\toh-pt6\node_modules\hash-base'
I'm having the same problem with similar libraries (like web3-eth-accounts). But I think that the problem comes from Angular upgrade and the webpack configuration.
Related issue here:
https://github.com/ethereum/web3.js/issues/1555
Workarounds suggested:
I tried these, and they didn't work for me! From what I understand it's an issue with the typings file. Or a dependency.
My workaround was to downgrade to an older version of web3:
npm install [email protected]
Another workaround is the suggested here: angular/angular-cli#1548 (comment)
It replaces the webpack config of @angular/cli
The solution with the patch worked for me!
https://gist.github.com/niespodd/1fa82da6f8c901d1c33d2fcbb762947d
node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/browser.js
node: {crypto: true, stream: true}
@Pedro-vk Thanks. It is working for me
Most helpful comment
The solution with the patch worked for me!
https://gist.github.com/niespodd/1fa82da6f8c901d1c33d2fcbb762947d