Ionic CloudModule Crypto.js Error

I’m referring to https://docs.ionic.io/setup.html to add my app to Ionic View. Whenever I add the line CloudModule.forRoot(cloudSettings) under imports as per the above tuitorial it throws below error

[INFO] Starting app-scripts server: --lab --l --port 8100 --p 8100 --livereload-port 35729 --r 35729 --address 0.0.0.0 - Ctrl+C to cancel
[18:39:44]  watch started ...
[18:39:44]  build dev started ...
[18:39:44]  clean started ...
[18:39:44]  clean finished in 5 ms
[18:39:44]  copy started ...
[18:39:44]  transpile started ...
[18:39:48]  transpile finished in 4.35 s
[18:39:48]  preprocess started ...
[18:39:48]  deeplinks started ...
[18:39:48]  deeplinks finished in 56 ms
[18:39:48]  preprocess finished in 60 ms
[18:39:48]  webpack started ...
[18:39:48]  copy finished in 4.71 s

crypto.js:74
  this._handle.update(data, encoding);
               ^

TypeError: Data must be a string or a buffer
    at TypeError (native)
    at Hash.update (crypto.js:74:16)
    at HarmonyExportImportedSpecifierDependency.updateHash (G:\Projects\Fortuna\Atithi\node_modules\webpack\lib\dependencies\HarmonyExportImportedSpecifierDependency.js:144:8)
    at G:\Projects\Fortuna\Atithi\node_modules\webpack\lib\DependenciesBlock.js:33:5
    at Array.forEach (native)
    at NormalModule.DependenciesBlock.updateHash (G:\Projects\Fortuna\Atithi\node_modules\webpack\lib\DependenciesBlock.js:32:20)
    at NormalModule.Module.updateHash (G:\Projects\Fortuna\Atithi\node_modules\webpack\lib\Module.js:162:41)
    at NormalModule.updateHash (G:\Projects\Fortuna\Atithi\node_modules\webpack\lib\NormalModule.js:327:30)
    at modules.forEach.m (G:\Projects\Fortuna\Atithi\node_modules\webpack\lib\Chunk.js:253:31)
    at Array.forEach (native)

I already tried doing npm install @ionic/cloud-angular@latest --save but it didn’t resolved the issue.

Can anyone please help me resolving it? Anyone else faced it before?

A possible problem is your environment, verify the version of NODEJS installed your machine and updated if necessary.

Can you send more information about your environment?

Thank’s

@marcusfloriano

node -v shows v6.11.0 and npm -v shows 3.10.10

I’m using Windows BTW.

Also, if it’s of any help to you, when I ran that NPM command I always get the below warnings

npm install @ionic/cloud-angular@latest --save

Atithi@0.0.1 G:\Projects\Fortuna\Atithi
`-- @ionic/cloud-angular@0.12.0

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN enoent ENOENT: no such file or directory, open 'G:\Projects\Fortuna\Atithi\node_modules\@ionic\cloud\package.json'

@krishnandusarkar

My environment it is different, below this info my environment, run the command for check your: ionic info.

➜ sporionicapp git:(master) ✗ ionic info

global packages:

@ionic/cli-utils : 1.3.0
Cordova CLI      : 7.0.1
Ionic CLI        : 3.3.0

local packages:

@ionic/app-scripts              : 1.3.7
@ionic/cli-plugin-cordova       : 1.3.0
@ionic/cli-plugin-ionic-angular : 1.3.0
Cordova Platforms               : ios 4.4.0
Ionic Framework                 : ionic-angular 3.3.0

System:

Node       : v7.10.0
OS         : macOS Sierra
Xcode      : Xcode 8.3.3 Build version 8E3004b
ios-deploy : 1.9.1
ios-sim    : not installed

@marcusfloriano Below is my ionic info result

global packages:

    @ionic/cli-utils : 1.3.0
    Ionic CLI        : 3.3.0

local packages:

    @ionic/app-scripts              : 1.3.7
    @ionic/cli-plugin-ionic-angular : 1.3.0
    Ionic Framework                 : ionic-angular 3.3.0

System:

    Node       : v6.11.0
    OS         : Windows 10
    Xcode      : not installed
    ios-deploy : not installed
    ios-sim    : not installed

@krishnandusarkar

Well, can you create new app with this command: ionic start myApp tabs.

This command create a new directory with name of “myApp”, enter the directory and run “ionic serve -c -l”. This should open the your browse with demo app.

I do not know if the problem is related to the version with NodeJS version, but this is good test to the verify if your environment is correct.

Thank’s.

Why do you need crypto.js? Can’t you achieve your results with WebCrypto?

@rapropos Well I don’t need either. It’s just that I want to upload my app to Ionic View. For that I was following https://docs.ionic.io/setup.html.

So after I did a npm install @ionic/cloud-angular@latest --save and added the code as per instructions there, it’s throwing this error.

When I comment out CloudModule.forRoot(cloudSettings) from imports array the error goes away. So I believe this is something internal.

I don’t have anything to do with crypto.js.

Sorry, I guess I misunderstood your topic. Haven’t ever used any Ionic Cloud services, so no clue.

@rapropos That’s absolutely fine. Hope someone using Ionic View notice this thread.

If you just want to use the Ionic View app, you don’t need any of that. Just run ionic upload and the app appears in your ionic.io account. Use the Ionic View app to download and view the app.

@Sujan12 Thanks a lot :slight_smile:

That worked :slight_smile:

If anyone else is having this issue, running npm install @ionic/cloud@latest.
This worked for me, I think there may have been a mismatch between ionic/cloud-angular and ionic/cloud.

Thanks!! This works great!! I think they should update their docs accordingly.