Material-table: Docker build fails on `npm install: Error while executing: undefined ls-remote -h -t ssh://[email protected]/eligrey/FileSaver.js.git

Created on 29 Jun 2020  路  14Comments  路  Source: mbrn/material-table

I am trying to build a Docker image but I get the following error:

Error while executing:
npm ERR! enoent undefined ls-remote -h -t ssh://[email protected]/eligrey/FileSaver.js.git

Simply running docker build .
When I take out material-table, the build passes.

bug wontfix

Most helpful comment

@scscgit
RUN apk add git works for an Alpine distribution, what would be the equivalent for node:12?

All 14 comments

I have this problem too:

> npm install material-table
npm ERR! code ENOENT
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno ENOENT
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t ssh://[email protected]/eligrey/FileSaver.js.git
npm ERR! enoent
npm ERR! enoent
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\user\AppData\Roaming\npm-cache\_logs\2020-06-30T08_32_59_747Z-debug.log

This seems to be caused by a dependency on Git being installed on the machine, so you can add this to your Dockerfile:

# Git needed by material-table
RUN apk add git

Hopefully this can be fixed in the future, so there's no such dependency required by default.

Here's one additional error message:
npm ERR! missing: file-saver@github:eligrey/FileSaver.js#1.3.8, required by [email protected]

The dependency of material-table on [email protected] can be seen by this dependency graph:
+-- [email protected]
| +-- @date-io/[email protected] deduped
| +-- @material-ui/[email protected] deduped
| +-- [email protected]
| +-- [email protected] deduped
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]

And this library seems to be used here:
https://github.com/mbrn/material-table/blob/22d8fca70c6d45b6035ca8972f8a0fce6ac350c5/src/components/m-table-toolbar.js#L73

I also believe that the explicit dependency on a GitHub repository may pose a security risk in the long-term.

@scscgit
RUN apk add git works for an Alpine distribution, what would be the equivalent for node:12?

Managed to get that it working with node:14-alpine

The problem was solved by installing GIT. Thanks!

I have this problem as well and I am not using docker. Is there going to be a dependency on git for this npm package? This is the only npm package with this issue that I've come across

Looks like pull request #1970 added the npm library jspdf. This library then relies on filesaver js. I'm not sure why it requires git.

This is an issue in jspdf: https://github.com/MrRio/jsPDF/issues/2208 . jspdf is using git for some reason, which is wrong. The fix is there already but it has never been released. To fix this issue completely in material-table, it should either not use jspdf at all or use a lower version that doesnt have this problem.

For now, if you want to use material-table, you should either use a lower version npm install [email protected] or have git installed in your server as a workaround.

For now and While jsPDF doesn't release a new version I manually updated dependencies on package-lock.json
On file-saver section

    "file-saver": {
-      "version": "github:eligrey/FileSaver.js#e865e37af9f9947ddcced76b549e27dc45c1cb2e",
-      "from": "github:eligrey/FileSaver.js#1.3.8"
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/file-saver/-/file-saver-2.0.1.tgz",
+      "integrity": "sha512-dCB3K7/BvAcUmtmh1DzFdv0eXSVJ9IAFt1mw3XZfAexodNRoE29l3xB2EX4wH2q8m/UTzwzEPq/ArYk98kUkBQ=="
````

On jsPDF section
```diff
- "file-saver": "github:eligrey/FileSaver.js#1.3.8",
+ "file-saver": "2.0.1",

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.

You can also change the url in your package.json to not depend on git executable:

"dependencies": [
    "file-saver": "https://github.com/eligrey/FileSaver.js/tarball/5bb701bd6ea05a02836daf8ef88ec350a1dd4d83",
]

instead of

"dependencies": [
    "file-saver": "ssh://[email protected]/eligrey/FileSaver.js.git#5bb701bd6ea05a02836daf8ef88ec350a1dd4d83",
]

(where 5bb701bd6ea05a02836daf8ef88ec350a1dd4d83 is the commit number)

I've fixed this by allowing GIT 9418 port and 22 port on the firewall settings, I don't know which fixed the problem though.

@scscgit RUN apk add git into the Dockerfile worked for me!

Maybe someone could re-open a new issue because of the stale bot?

Seeing recent comments, latest version of material-table includes new jspdf version that does not have the git dependency

Was this page helpful?
0 / 5 - 0 ratings