Can't load SDK on Angular8 app
Hi,
I'm trying to import the SDK on a module, but I get a lot of error when I compile the app.
I'm trying to import the SDK with:
(the sdk is installed, with npm install --save rainbow-node-sdk)
When I compile the app, I get this list or errors:
(base) obiMacBook:sematConfig obi$ ng b
Date: 2019-06-18T12:35:37.511Z
Hash: d79df0a125aeb6cdaec8
Time: 9947ms
chunk {main} main-es5.js, main-es5.js.map (main) 29.4 kB [initial] [rendered]
chunk {polyfills} polyfills-es5.js, polyfills-es5.js.map (polyfills) 546 kB [initial] [rendered]
chunk {runtime} runtime-es5.js, runtime-es5.js.map (runtime) 6.08 kB [entry] [rendered]
chunk {styles} styles-es5.js, styles-es5.js.map (styles) 1.13 MB [initial] [rendered]
chunk {vendor} vendor-es5.js, vendor-es5.js.map (vendor) 9.01 MB [initial] [rendered]
ERROR in ./node_modules/rainbow-node-sdk/lib/connection/XMPPServiceHandler/iqEventHandler.js
Module not found: Error: Can't resolve '../../../package' in '/Users/obi/Projects/sematConfig/node_modules/rainbow-node-sdk/lib/connection/XMPPServiceHandler'
ERROR in ./node_modules/rainbow-node-sdk/lib/connection/XMPPService.js
Module not found: Error: Can't resolve '../../package' in '/Users/obi/Projects/sematConfig/node_modules/rainbow-node-sdk/lib/connection'
ERROR in ./node_modules/aws-sign2/index.js
Module not found: Error: Can't resolve 'crypto' in '/Users/obi/Projects/sematConfig/node_modules/aws-sign2'
ERROR in ./node_modules/aws4/aws4.js
Module not found: Error: Can't resolve 'crypto' in '/Users/obi/Projects/sematConfig/node_modules/aws4'
ERROR in ./node_modules/ecc-jsbn/index.js
Module not found: Error: Can't resolve 'crypto' in '/Users/obi/Projects/sematConfig/node_modules/ecc-jsbn'
ERROR in ./node_modules/file-stream-rotator/FileStreamRotator.js
Module not found: Error: Can't resolve 'crypto' in '/Users/obi/Projects/sematConfig/node_modules/file-stream-rotator'
ERROR in ./node_modules/http-signature/lib/signer.js
Module not found: Error: Can't resolve 'crypto' in '/Users/obi/Projects/sematConfig/node_modules/http-signature/lib'
ERROR in ./node_modules/http-signature/lib/verify.js
Module not found: Error: Can't resolve 'crypto' in '/Users/obi/Projects/sematConfig/node_modules/http-signature/lib'
ERROR in ./node_modules/oauth-sign/index.js
Module not found: Error: Can't resolve 'crypto' in '/Users/obi/Projects/sematConfig/node_modules/oauth-sign'
ERROR in ./node_modules/rainbow-node-sdk/lib/services/FileServerService.js
Module not found: Error: Can't resolve 'crypto' in '/Users/obi/Projects/sematConfig/node_modules/rainbow-node-sdk/lib/services'
ERROR in ./node_modules/request/lib/oauth.js
Module not found: Error: Can't resolve 'crypto' in '/Users/obi/Projects/sematConfig/node_modules/request/lib'
ERROR in ./node_modules/request/lib/hawk.js
Module not found: Error: Can't resolve 'crypto' in '/Users/obi/Projects/sematConfig/node_modules/request/lib'
ERROR in ./node_modules/request/lib/helpers.js
Module not found: Error: Can't resolve 'crypto' in '/Users/obi/Projects/sematConfig/node_modules/request/lib'
ERROR in ./node_modules/sshpk/lib/signature.js
Module not found: Error: Can't resolve 'crypto' in '/Users/obi/Projects/sematConfig/node_modules/sshpk/lib'
ERROR in ./node_modules/sshpk/lib/identity.js
Module not found: Error: Can't resolve 'crypto' in '/Users/obi/Projects/sematConfig/node_modules/sshpk/lib'
ERROR in ./node_modules/sshpk/lib/certificate.js
Module not found: Error: Can't resolve 'crypto' in '/Users/obi/Projects/sematConfig/node_modules/sshpk/lib'
ERROR in ./node_modules/sshpk/lib/private-key.js
Module not found: Error: Can't resolve 'crypto' in '/Users/obi/Projects/sematConfig/node_modules/sshpk/lib'
ERROR in ./node_modules/sshpk/lib/utils.js
Module not found: Error: Can't resolve 'crypto' in '/Users/obi/Projects/sematConfig/node_modules/sshpk/lib'
ERROR in ./node_modules/sshpk/lib/fingerprint.js
Module not found: Error: Can't resolve 'crypto' in '/Users/obi/Projects/sematConfig/node_modules/sshpk/lib'
ERROR in ./node_modules/sshpk/lib/dhe.js
Module not found: Error: Can't resolve 'crypto' in '/Users/obi/Projects/sematConfig/node_modules/sshpk/lib'
ERROR in ./node_modules/sshpk/lib/key.js
Module not found: Error: Can't resolve 'crypto' in '/Users/obi/Projects/sematConfig/node_modules/sshpk/lib'
ERROR in ./node_modules/sshpk/lib/formats/ssh-private.js
Module not found: Error: Can't resolve 'crypto' in '/Users/obi/Projects/sematConfig/node_modules/sshpk/lib/formats'
ERROR in ./node_modules/sshpk/lib/formats/openssh-cert.js
Module not found: Error: Can't resolve 'crypto' in '/Users/obi/Projects/sematConfig/node_modules/sshpk/lib/formats'
ERROR in ./node_modules/sshpk/lib/formats/pem.js
Module not found: Error: Can't resolve 'crypto' in '/Users/obi/Projects/sematConfig/node_modules/sshpk/lib/formats'
ERROR in ./node_modules/uuid4/index.js
Module not found: Error: Can't resolve 'crypto' in '/Users/obi/Projects/sematConfig/node_modules/uuid4'
ERROR in ./node_modules/file-stream-rotator/FileStreamRotator.js
Module not found: Error: Can't resolve 'fs' in '/Users/obi/Projects/sematConfig/node_modules/file-stream-rotator'
ERROR in ./node_modules/rainbow-node-sdk/lib/common/Logger.js
Module not found: Error: Can't resolve 'fs' in '/Users/obi/Projects/sematConfig/node_modules/rainbow-node-sdk/lib/common'
ERROR in ./node_modules/rainbow-node-sdk/lib/services/FileServerService.js
Module not found: Error: Can't resolve 'fs' in '/Users/obi/Projects/sematConfig/node_modules/rainbow-node-sdk/lib/services'
ERROR in ./node_modules/rainbow-node-sdk/lib/services/ChannelsService.js
Module not found: Error: Can't resolve 'fs' in '/Users/obi/Projects/sematConfig/node_modules/rainbow-node-sdk/lib/services'
ERROR in ./node_modules/request/lib/har.js
Module not found: Error: Can't resolve 'fs' in '/Users/obi/Projects/sematConfig/node_modules/request/lib'
ERROR in ./node_modules/winston-daily-rotate-file/daily-rotate-file.js
Module not found: Error: Can't resolve 'fs' in '/Users/obi/Projects/sematConfig/node_modules/winston-daily-rotate-file'
ERROR in ./node_modules/winston/dist/winston/tail-file.js
Module not found: Error: Can't resolve 'fs' in '/Users/obi/Projects/sematConfig/node_modules/winston/dist/winston'
ERROR in ./node_modules/winston/dist/winston/transports/file.js
Module not found: Error: Can't resolve 'fs' in '/Users/obi/Projects/sematConfig/node_modules/winston/dist/winston/transports'
ERROR in ./node_modules/debug-http/index.js
Module not found: Error: Can't resolve 'http' in '/Users/obi/Projects/sematConfig/node_modules/debug-http'
ERROR in ./node_modules/forever-agent/index.js
Module not found: Error: Can't resolve 'http' in '/Users/obi/Projects/sematConfig/node_modules/forever-agent'
ERROR in ./node_modules/http-signature/lib/signer.js
Module not found: Error: Can't resolve 'http' in '/Users/obi/Projects/sematConfig/node_modules/http-signature/lib'
ERROR in ./node_modules/request/request.js
Module not found: Error: Can't resolve 'http' in '/Users/obi/Projects/sematConfig/node_modules/request'
ERROR in ./node_modules/tunnel-agent/index.js
Module not found: Error: Can't resolve 'http' in '/Users/obi/Projects/sematConfig/node_modules/tunnel-agent'
ERROR in ./node_modules/winston/dist/winston/transports/http.js
Module not found: Error: Can't resolve 'http' in '/Users/obi/Projects/sematConfig/node_modules/winston/dist/winston/transports'
ERROR in ./node_modules/agent-base/patch-core.js
Module not found: Error: Can't resolve 'https' in '/Users/obi/Projects/sematConfig/node_modules/agent-base'
ERROR in ./node_modules/forever-agent/index.js
Module not found: Error: Can't resolve 'https' in '/Users/obi/Projects/sematConfig/node_modules/forever-agent'
ERROR in ./node_modules/request/request.js
Module not found: Error: Can't resolve 'https' in '/Users/obi/Projects/sematConfig/node_modules/request'
ERROR in ./node_modules/tunnel-agent/index.js
Module not found: Error: Can't resolve 'https' in '/Users/obi/Projects/sematConfig/node_modules/tunnel-agent'm
ERROR in ./node_modules/winston/dist/winston/transports/http.js
Module not found: Error: Can't resolve 'https' in '/Users/obi/Projects/sematConfig/node_modules/winston/dist/winston/transports'
ERROR in ./node_modules/rainbow-node-sdk/lib/connection/XMPPService.js
Module not found: Error: Can't resolve 'mock-socket' in '/Users/obi/Projects/sematConfig/node_modules/rainbow-node-sdk/lib/connection'
ERROR in ./node_modules/@xmpp/connection-tcp/index.js
Module not found: Error: Can't resolve 'net' in '/Users/obi/Projects/sematConfig/node_modules/@xmpp/connection-tcp'
ERROR in ./node_modules/forever-agent/index.js
Module not found: Error: Can't resolve 'net' in '/Users/obi/Projects/sematConfig/node_modules/forever-agent'
ERROR in ./node_modules/https-proxy-agent/index.js
Module not found: Error: Can't resolve 'net' in '/Users/obi/Projects/sematConfig/node_modules/https-proxy-agent'
ERROR in ./node_modules/tough-cookie/lib/cookie.js
Module not found: Error: Can't resolve 'net' in '/Users/obi/Projects/sematConfig/node_modules/tough-cookie/lib'
ERROR in ./node_modules/tunnel-agent/index.js
Module not found: Error: Can't resolve 'net' in '/Users/obi/Projects/sematConfig/node_modules/tunnel-agent'
ERROR in ./node_modules/logform/node_modules/colors/lib/system/supports-colors.js
Module not found: Error: Can't resolve 'os' in '/Users/obi/Projects/sematConfig/node_modules/logform/node_modules/colors/lib/system'
ERROR in ./node_modules/rainbow-node-sdk/node_modules/colors/lib/system/supports-colors.js
Module not found: Error: Can't resolve 'os' in '/Users/obi/Projects/sematConfig/node_modules/rainbow-node-sdk/node_modules/colors/lib/system'
ERROR in ./node_modules/winston-compat/node_modules/colors/lib/system/supports-colors.js
Module not found: Error: Can't resolve 'os' in '/Users/obi/Projects/sematConfig/node_modules/winston-compat/node_modules/colors/lib/system'
ERROR in ./node_modules/winston-daily-rotate-file/daily-rotate-file.js
Module not found: Error: Can't resolve 'os' in '/Users/obi/Projects/sematConfig/node_modules/winston-daily-rotate-file'
ERROR in ./node_modules/winston/dist/winston/rejection-handler.js
Module not found: Error: Can't resolve 'os' in '/Users/obi/Projects/sematConfig/node_modules/winston/dist/winston'
ERROR in ./node_modules/winston/dist/winston/exception-handler.js
Module not found: Error: Can't resolve 'os' in '/Users/obi/Projects/sematConfig/node_modules/winston/dist/winston'
ERROR in ./node_modules/winston/dist/winston/transports/file.js
Module not found: Error: Can't resolve 'os' in '/Users/obi/Projects/sematConfig/node_modules/winston/dist/winston/transports'
ERROR in ./node_modules/winston/dist/winston/transports/console.js
Module not found: Error: Can't resolve 'os' in '/Users/obi/Projects/sematConfig/node_modules/winston/dist/winston/transports'
ERROR in ./node_modules/winston/dist/winston/transports/stream.js
Module not found: Error: Can't resolve 'os' in '/Users/obi/Projects/sematConfig/node_modules/winston/dist/winston/transports'
ERROR in ./node_modules/file-stream-rotator/FileStreamRotator.js
Module not found: Error: Can't resolve 'path' in '/Users/obi/Projects/sematConfig/node_modules/file-stream-rotator'
ERROR in ./node_modules/mime-types/index.js
Module not found: Error: Can't resolve 'path' in '/Users/obi/Projects/sematConfig/node_modules/mime-types'
ERROR in ./node_modules/rainbow-node-sdk/lib/services/ContactsService.js
Module not found: Error: Can't resolve 'path' in '/Users/obi/Projects/sematConfig/node_modules/rainbow-node-sdk/lib/services'
ERROR in ./node_modules/winston-daily-rotate-file/daily-rotate-file.js
Module not found: Error: Can't resolve 'path' in '/Users/obi/Projects/sematConfig/node_modules/winston-daily-rotate-file'
ERROR in ./node_modules/winston/dist/winston/transports/file.js
Module not found: Error: Can't resolve 'path' in '/Users/obi/Projects/sematConfig/node_modules/winston/dist/winston/transports'
ERROR in ./node_modules/assert-plus/assert.js
Module not found: Error: Can't resolve 'stream' in '/Users/obi/Projects/sematConfig/node_modules/assert-plus'
ERROR in ./node_modules/combined-stream/lib/combined_stream.js
Module not found: Error: Can't resolve 'stream' in '/Users/obi/Projects/sematConfig/node_modules/combined-stream/lib'
ERROR in ./node_modules/delayed-stream/lib/delayed_stream.js
Module not found: Error: Can't resolve 'stream' in '/Users/obi/Projects/sematConfig/node_modules/delayed-stream/lib'
ERROR in ./node_modules/isstream/isstream.js
Module not found: Error: Can't resolve 'stream' in '/Users/obi/Projects/sematConfig/node_modules/isstream'
ERROR in ./node_modules/request/request.js
Module not found: Error: Can't resolve 'stream' in '/Users/obi/Projects/sematConfig/node_modules/request'
ERROR in ./node_modules/sshpk/lib/ed-compat.js
Module not found: Error: Can't resolve 'stream' in '/Users/obi/Projects/sematConfig/node_modules/sshpk/lib'
ERROR in ./node_modules/stream-buffers/lib/writable_streambuffer.js
Module not found: Error: Can't resolve 'stream' in '/Users/obi/Projects/sematConfig/node_modules/stream-buffers/lib'
ERROR in ./node_modules/stream-buffers/lib/readable_streambuffer.js
Module not found: Error: Can't resolve 'stream' in '/Users/obi/Projects/sematConfig/node_modules/stream-buffers/lib'
ERROR in ./node_modules/winston-daily-rotate-file/daily-rotate-file.js
Module not found: Error: Can't resolve 'stream' in '/Users/obi/Projects/sematConfig/node_modules/winston-daily-rotate-file'
ERROR in ./node_modules/@xmpp/starttls/client.js
Module not found: Error: Can't resolve 'tls' in '/Users/obi/Projects/sematConfig/node_modules/@xmpp/starttls'
ERROR in ./node_modules/@xmpp/tls/lib/Connection.js
Module not found: Error: Can't resolve 'tls' in '/Users/obi/Projects/sematConfig/node_modules/@xmpp/tls/lib'
ERROR in ./node_modules/forever-agent/index.js
Module not found: Error: Can't resolve 'tls' in '/Users/obi/Projects/sematConfig/node_modules/forever-agent'
ERROR in ./node_modules/https-proxy-agent/index.js
Module not found: Error: Can't resolve 'tls' in '/Users/obi/Projects/sematConfig/node_modules/https-proxy-agent'
ERROR in ./node_modules/tunnel-agent/index.js
Module not found: Error: Can't resolve 'tls' in '/Users/obi/Projects/sematConfig/node_modules/tunnel-agent'
ERROR in ./node_modules/request/request.js
Module not found: Error: Can't resolve 'zlib' in '/Users/obi/Projects/sematConfig/node_modules/request'
ERROR in ./node_modules/winston-daily-rotate-file/daily-rotate-file.js
Module not found: Error: Can't resolve 'zlib' in '/Users/obi/Projects/sematConfig/node_modules/winston-daily-rotate-file'
ERROR in ./node_modules/winston/dist/winston/transports/file.js
Module not found: Error: Can't resolve 'zlib' in '/Users/obi/Projects/sematConfig/node_modules/winston/dist/winston/transports'
Maybe this can be useful:
(base) obiMacBook:sematConfig obi$ ng --version
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 8.0.3
Node: 10.16.0
OS: darwin x64
Angular: 8.0.1
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.800.3
@angular-devkit/build-angular 0.800.3
@angular-devkit/build-optimizer 0.800.3
@angular-devkit/build-webpack 0.800.3
@angular-devkit/core 8.0.3
@angular-devkit/schematics 8.0.3
@angular/cli 8.0.3
@ngtools/webpack 8.0.3
@schematics/angular 8.0.3
@schematics/update 0.800.3
rxjs 6.4.0
typescript 3.4.5
webpack 4.30.0
Thanks,
-
Hi,
at the moment Rainbow Web SDK doesn't come as ES Module, therefore you can't import a rainbowSDK variable to your application.
In order to find out how to add Rainbow Web SDK to your app, please check our documentation:
https://hub.openrainbow.com/#/documentation/doc/sdk/web/guides/Getting_Started
You can also use Angular starter kit which will allow you to kickstart a new project with a fully set-up SDK: https://github.com/Rainbow-CPaaS/StarterKit-SDKWeb-Angular2
Best Regards,
Konrad
-
Hi Josep,
For Angular 8 developments you need to use the Rainbow Web SDK.
https://www.npmjs.com/package/rainbow-web-sdk
Best Regards
Marc -
Hi I also face a similar problem when I installed rainbow-node-sdk to my react website.
This is my error:
Module not found: Can't resolve 'mock-socket' in 'C:\Users\daryl\Desktop\test-web-app\node_modules\rainbow-node-sdk\lib\connection'May I know what is wrong and how can i resolve it?
-
Konrad Hyzy thanks for the prompt reply. I want to use the node sdk in particular because it has "createGuestAccount" which the websdk does not have. So you are saying I definitely cant use the node sdk for react apps?
Please sign in to leave a comment.
Comments
7 comments