SDK with Angular. Error building with Cipher-base

I´m using Angular to develop a Daepp with an a Sophia contract but I cannot make it work properly.
I made my contract and it works fine, but I want to tested, so I made an Angular project, first off I want to try if I can make the connection between my front and the Contract. I follow the tutorial on Dacade and I install the SDK with node as the documentation says (npm install @Albert/aepp-sdk) but everytime that I try to make anything with this library it drops me this error in the console:

“Uncaught ReferenceError: global is not defined
at Object…/node_modules/buffer/index.js (index.js:43)
at webpack_require (bootstrap:79)
at Object…/node_modules/safe-buffer/index.js (index.js:2)
at webpack_require (bootstrap:79)
at Object…/node_modules/hash-base/index.js (index.js:2)
at webpack_require (bootstrap:79)
at Object…/node_modules/md5.js/index.js (index.js:3)
at webpack_require (bootstrap:79)
at Object…/node_modules/create-hash/browser.js (browser.js:3)
at webpack_require (bootstrap:79)”

I have been trying for days to fix this but gives me no result. Please help me

This is my code : https://github.com/Gabriel1590/aeternity-bets-angular.git

@nikitafuchs.chain has done this before, he can probably help you

Thanks @philipp.chain. @nikitafuchs.chain, could You help me?

I have been seen the documentation and I think I fix it, but first I need to build the project in order to upload to Github. But if I tried to (ng build --prod) gives me this error:

ERROR in ./node_modules/cipher-base/index.js
Module not found: Error: Can’t resolve ‘stream’ in ‘C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\cipher-base’
resolve ‘stream’ in ‘C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\cipher-base’
Parsed request is a module
using description file: C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\cipher-base\package.json (relative path: .)
Field ‘browser’ doesn’t contain a valid alias configuration
resolve as module
looking for modules in C:/Users/Gabriel/Documents/Aeternity-bets/
using description file: C:\Users\Gabriel\Documents\Aeternity-bets\package.json (relative path: .)
Field ‘browser’ doesn’t contain a valid alias configuration
using description file: C:\Users\Gabriel\Documents\Aeternity-bets\package.json (relative path: ./stream)
no extension
Field ‘browser’ doesn’t contain a valid alias configuration
C:\Users\Gabriel\Documents\Aeternity-bets\stream doesn’t exist
.ts
Field ‘browser’ doesn’t contain a valid alias configuration
C:\Users\Gabriel\Documents\Aeternity-bets\stream.ts doesn’t exist
.tsx
Field ‘browser’ doesn’t contain a valid alias configuration
C:\Users\Gabriel\Documents\Aeternity-bets\stream.tsx doesn’t exist
.mjs
Field ‘browser’ doesn’t contain a valid alias configuration
C:\Users\Gabriel\Documents\Aeternity-bets\stream.mjs doesn’t exist
.js
Field ‘browser’ doesn’t contain a valid alias configuration
C:\Users\Gabriel\Documents\Aeternity-bets\stream.js doesn’t exist
as directory
C:\Users\Gabriel\Documents\Aeternity-bets\stream doesn’t exist
C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\cipher-base\node_modules doesn’t exist or is not a directory
C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\node_modules doesn’t exist or is not a directory
C:\Users\Gabriel\Documents\node_modules doesn’t exist or is not a directory
C:\Users\Gabriel\node_modules doesn’t exist or is not a directory
C:\Users\node_modules doesn’t exist or is not a directory
C:\node_modules doesn’t exist or is not a directory
looking for modules in C:\Users\Gabriel\Documents\Aeternity-bets\node_modules
using description file: C:\Users\Gabriel\Documents\Aeternity-bets\package.json (relative path: ./node_modules)
Field ‘browser’ doesn’t contain a valid alias configuration
using description file: C:\Users\Gabriel\Documents\Aeternity-bets\package.json (relative path: ./node_modules/stream)
no extension
Field ‘browser’ doesn’t contain a valid alias configuration
C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\stream doesn’t exist
.ts
Field ‘browser’ doesn’t contain a valid alias configuration
C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\stream.ts doesn’t exist
.tsx
Field ‘browser’ doesn’t contain a valid alias configuration
C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\stream.tsx doesn’t exist
.mjs
Field ‘browser’ doesn’t contain a valid alias configuration
C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\stream.mjs doesn’t exist
.js
Field ‘browser’ doesn’t contain a valid alias configuration
C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\stream.js doesn’t exist
as directory
C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\stream doesn’t exist
[C:\Users\Gabriel\Documents\Aeternity-bets\stream]
[C:\Users\Gabriel\Documents\Aeternity-bets\stream.ts]
[C:\Users\Gabriel\Documents\Aeternity-bets\stream.tsx]
[C:\Users\Gabriel\Documents\Aeternity-bets\stream.mjs]
[C:\Users\Gabriel\Documents\Aeternity-bets\stream.js]
[C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\cipher-base\node_modules]
[C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\node_modules]
[C:\Users\Gabriel\Documents\node_modules]
[C:\Users\Gabriel\node_modules]
[C:\Users\node_modules]
[C:\node_modules]
[C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\stream]
[C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\stream.ts]
[C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\stream.tsx]
[C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\stream.mjs]
[C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\stream.js]
@ ./node_modules/cipher-base/index.js 2:16-33
@ ./node_modules/create-hash/browser.js
@ ./node_modules/bs58check/index.js
@ ./node_modules/@Albert/aepp-sdk/es/utils/crypto.js
@ ./node_modules/@Albert/aepp-sdk/es/ae/index.js
@ ./node_modules/@Albert/aepp-sdk/es/ae/aepp.js
@ ./src/app/services/contract.service.ts
@ ./src/app/pages/home/home.component.ngfactory.js
@ ./src/app/app.module.ngfactory.js
@ ./src/main.ts
@ multi ./src/main.ts
ERROR in ./node_modules/hash-base/index.js
Module not found: Error: Can’t resolve ‘stream’ in ‘C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\hash-base’
resolve ‘stream’ in ‘C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\hash-base’
Parsed request is a module
using description file: C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\hash-base\package.json (relative path: .)
Field ‘browser’ doesn’t contain a valid alias configuration
resolve as module
looking for modules in C:/Users/Gabriel/Documents/Aeternity-bets/
using description file: C:\Users\Gabriel\Documents\Aeternity-bets\package.json (relative path: .)
Field ‘browser’ doesn’t contain a valid alias configuration
using description file: C:\Users\Gabriel\Documents\Aeternity-bets\package.json (relative path: ./stream)
no extension
Field ‘browser’ doesn’t contain a valid alias configuration
C:\Users\Gabriel\Documents\Aeternity-bets\stream doesn’t exist
.ts
Field ‘browser’ doesn’t contain a valid alias configuration
C:\Users\Gabriel\Documents\Aeternity-bets\stream.ts doesn’t exist
.tsx
Field ‘browser’ doesn’t contain a valid alias configuration
C:\Users\Gabriel\Documents\Aeternity-bets\stream.tsx doesn’t exist
.mjs
Field ‘browser’ doesn’t contain a valid alias configuration
C:\Users\Gabriel\Documents\Aeternity-bets\stream.mjs doesn’t exist
.js
Field ‘browser’ doesn’t contain a valid alias configuration
C:\Users\Gabriel\Documents\Aeternity-bets\stream.js doesn’t exist
as directory
C:\Users\Gabriel\Documents\Aeternity-bets\stream doesn’t exist
C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\hash-base\node_modules doesn’t exist or is not a directory
C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\node_modules doesn’t exist or is not a directory
C:\Users\Gabriel\Documents\node_modules doesn’t exist or is not a directory
C:\Users\Gabriel\node_modules doesn’t exist or is not a directory
C:\Users\node_modules doesn’t exist or is not a directory
C:\node_modules doesn’t exist or is not a directory
looking for modules in C:\Users\Gabriel\Documents\Aeternity-bets\node_modules
using description file: C:\Users\Gabriel\Documents\Aeternity-bets\package.json (relative path: ./node_modules)
Field ‘browser’ doesn’t contain a valid alias configuration
using description file: C:\Users\Gabriel\Documents\Aeternity-bets\package.json (relative path: ./node_modules/stream)
no extension
Field ‘browser’ doesn’t contain a valid alias configuration
C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\stream doesn’t exist
.ts
Field ‘browser’ doesn’t contain a valid alias configuration
C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\stream.ts doesn’t exist
.tsx
Field ‘browser’ doesn’t contain a valid alias configuration
C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\stream.tsx doesn’t exist
.mjs
Field ‘browser’ doesn’t contain a valid alias configuration
C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\stream.mjs doesn’t exist
.js
Field ‘browser’ doesn’t contain a valid alias configuration
C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\stream.js doesn’t exist
as directory
C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\stream doesn’t exist
[C:\Users\Gabriel\Documents\Aeternity-bets\stream]
[C:\Users\Gabriel\Documents\Aeternity-bets\stream.ts]
[C:\Users\Gabriel\Documents\Aeternity-bets\stream.tsx]
[C:\Users\Gabriel\Documents\Aeternity-bets\stream.mjs]
[C:\Users\Gabriel\Documents\Aeternity-bets\stream.js]
[C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\hash-base\node_modules]
[C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\node_modules]
[C:\Users\Gabriel\Documents\node_modules]
[C:\Users\Gabriel\node_modules]
[C:\Users\node_modules]
[C:\node_modules]
[C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\stream]
[C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\stream.ts]
[C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\stream.tsx]
[C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\stream.mjs]
[C:\Users\Gabriel\Documents\Aeternity-bets\node_modules\stream.js]
@ ./node_modules/hash-base/index.js 3:16-33
@ ./node_modules/md5.js/index.js
@ ./node_modules/create-hash/browser.js
@ ./node_modules/bs58check/index.js
@ ./node_modules/@Albert/aepp-sdk/es/utils/crypto.js
@ ./node_modules/@Albert/aepp-sdk/es/ae/index.js
@ ./node_modules/@Albert/aepp-sdk/es/ae/aepp.js
@ ./src/app/services/contract.service.ts
@ ./src/app/pages/home/home.component.ngfactory.js
@ ./src/app/app.module.ngfactory.js
@ ./src/main.ts
@ multi ./src/main.ts

This is my package.json:

{

“name”: “aeternity-bets”,

“version”: “0.0.0”,

“scripts”: {

"ng": "ng",

"start": "ng serve",

"build": "ng build",

"test": "ng test",

"lint": "ng lint",

"e2e": "ng e2e"

},

“private”: true,

“dependencies”: {

"@aeternity/aepp-sdk": "^6.1.2",

"@angular/animations": "~8.2.14",

"@angular/common": "~8.2.14",

"@angular/compiler": "~8.2.14",

"@angular/core": "~8.2.14",

"@angular/forms": "~8.2.14",

"@angular/platform-browser": "~8.2.14",

"@angular/platform-browser-dynamic": "~8.2.14",

"@angular/router": "~8.2.14",

"cipher-base": "^1.0.4",

"rxjs": "~6.4.0",

"tslib": "^1.10.0",

"zone.js": "~0.9.1"

},

“devDependencies”: {

"@angular-devkit/build-angular": "~0.803.23",

"@angular/cli": "~8.3.23",

"@angular/compiler-cli": "~8.2.14",

"@angular/language-service": "~8.2.14",

"@types/node": "~8.9.4",

"@types/jasmine": "~3.3.8",

"@types/jasminewd2": "~2.0.3",

"codelyzer": "^5.0.0",

"jasmine-core": "~3.4.0",

"jasmine-spec-reporter": "~4.2.1",

"karma": "~4.1.0",

"karma-chrome-launcher": "~2.2.0",

"karma-coverage-istanbul-reporter": "~2.0.1",

"karma-jasmine": "~2.0.1",

"karma-jasmine-html-reporter": "^1.4.0",

"protractor": "~5.4.0",

"ts-node": "~7.0.0",

"tslint": "~5.15.0",

"typescript": "~3.5.3"

}

}