'Unable to resolve file-saver.js dependency file from bower install angular-file-saver

I'm using the following command - bower install angular-file-saver --save , which has internal dependency on bower file-saver.js#~1.20150507.2. This dependency is not able to download as this is not available at this git url - https://github.com/Teleborder/FileSaver.js.git#~1.20150507.2.

It is showing the following error - ECMDERR Failed to execute "git ls-remote --tags --heads https://github.com/Teleborder/FileSaver.js.git", exit code of #128 fatal. Clicking on that link gives me a 404 error.

I can use the command bower install FileSaver --save and it downloads fine but it won't resolve for the dependency of bower install angular-file-saver.



Solution 1:[1]

I had the same issue,

Due to the aparently abandon of the original repo, I forked and create a new npm package ng-file-saver with the fix.

Basically y updated the FileSaver.js dependency, the rest of the code was no changed

https://www.npmjs.com/package/ng-file-saver

NPM

  • npm i ng-file-saver

BOWER

As Bower is deprecated, registering new Bower packages is not supported anymore. Neverthless you can install any GitHub repository as Bower package by putting full name in bower.json:

{
  "dependencies": {
    "angular-file-saver": "elquimeras/ng-file-saver#^1.1.4"
  }
}

You can install any dependency from github with CLI as well:

bower install elquimeras/ng-file-saver --save

Solution 2:[2]

We were able to resolve by using the npm package rather than the bower one: https://www.npmjs.com/package/file-saver

  1. Remove the file-saver line from the bower.json file
  2. Install via npm (or yarn, or pnpm...): npm install --save [email protected]

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 BlackSlash
Solution 2 Ophir Gross