Nativescript-cli: [Android] Error CLI from Bcryptjs

Created on 8 Apr 2019  路  3Comments  路  Source: NativeScript/nativescript-cli

Hi,

The CLI return error for duplicated ressources :

Bcryptjs comme with tow file in dist directory :

  • bcrypt.min.js.gz
  • bcrypt.min.js

If we remove the bcrypt.min.js.gz the is no problem .. but if we add new module the dependency's will be updated and the issu comeback !

"tns-android": {
      "version": "5.3.1"
    },
    "tns-ios": {
      "version": "5.3.1"
    }
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugAssets'.
> [app/tns_modules/bcryptjs/dist/bcrypt.min.js] project_name/platforms/android/app/src/main/assets/app/tns_modules/bcryptjs/dist/bcrypt.min.js.gz        
[app/tns_modules/bcryptjs/dist/bcrypt.min.js] project_name/platforms/android/app/src/main/assets/app/tns_modules/bcryptjs/dist/bcrypt.min.js: Error: Duplicate resources

thanks

bug android

All 3 comments

@kefahB thank you for reporting this issue.

Confirming the behavior as reproducible with base NativeScript app.
Steps to reporduce:

tns create test-app
npm i bcryptjs --save
tns build

fails with

* What went wrong:
Execution failed for task ':app:mergeDebugAssets'.
> [app/tns_modules/bcryptjs/dist/bcrypt.min.js] D:\git\NS-Issues-2019-I\nativescript-cli\issue-4513\platforms\android\app\src\main\assets\app\tns_modules\bcryptjs\dist\bcrypt.min.js   [app/tns_modules/bcryptjs/dist/bcrypt.min.js] D:\git\NS-Issues-2019-I\nativescript-cli\issue-4513\platforms\android\app\src\main\assets\app\tns_modules\bcryptjs\dist\bcrypt.min.js.gz: Error: Duplicate resources

The workaround suggested by @kefahB is working (remove the *.gz file from node_modules and rebuild the app with deleted platforms folder).

@kefahB the issue is also not existing when making a Webpack build with bundle

For example

tns create test-app
npm i bcryptjs --save
tns build android --bundle

The above is working as expected. Btw as in the future releases, we are heading for Webpack by default experience, you should consider using the bundle flag for all your builds (there are only benefits for using bundling including smaller size, faster builds, etc.)

This issue is not reproducible with bundle workflow and as in NativeScript 6.0 we'll support only this workflow, I'm closing it.

Was this page helpful?
0 / 5 - 0 ratings