yWorks / jsPDF

JavaScript PDF generation to work with SVG
MIT License
56 stars 23 forks source link

`npm install` fails with "Permission denied (publickey)" errors #10

Closed zedtux closed 6 years ago

zedtux commented 6 years ago

Running npm install from the svg2pdf.js package fails with:

npm ERR! git clone git@github.com:github:andyinabox/FileSaver.js Cloning into bare repository '/home/pharmony/.npm/_git-remotes/git-github-com-github-andyinabox-FileSaver-js-59c031cf'...
npm ERR! git clone git@github.com:github:andyinabox/FileSaver.js Permission denied (publickey).
npm ERR! git clone git@github.com:github:andyinabox/FileSaver.js fatal: Could not read from remote repository.
npm ERR! git clone git@github.com:github:andyinabox/FileSaver.js
npm ERR! git clone git@github.com:github:andyinabox/FileSaver.js Please make sure you have the correct access rights
npm ERR! git clone git@github.com:github:andyinabox/FileSaver.js and the repository exists.
npm ERR! git clone git@github.com:github:chick307/adler32cs.js Cloning into bare repository '/home/pharmony/.npm/_git-remotes/git-github-com-github-chick307-adler32cs-js-029b2fc0'...
npm ERR! git clone git@github.com:github:chick307/adler32cs.js Permission denied (publickey).
npm ERR! git clone git@github.com:github:chick307/adler32cs.js fatal: Could not read from remote repository.
npm ERR! git clone git@github.com:github:chick307/adler32cs.js
npm ERR! git clone git@github.com:github:chick307/adler32cs.js Please make sure you have the correct access rights
npm ERR! git clone git@github.com:github:chick307/adler32cs.js and the repository exists.
npm ERR! notarget No compatible version found: filesaver.js@'github:andyinabox/FileSaver.js'
npm ERR! notarget Valid install targets:
npm ERR! notarget ["0.1.0","0.1.1","0.2.0","1.3.4"]
npm ERR! notarget
npm ERR! notarget This is most likely not a problem with npm itself.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

npm ERR! System Linux 4.9.49-moby
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /application/vendor/assets/javascripts/svg2pdf.js
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.21
npm ERR! code ETARGET
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /application/vendor/assets/javascripts/svg2pdf.js/npm-debug.log
npm ERR! not ok code 0
yGuy commented 6 years ago

Hmmm - thanks for the report. Are you sure this is necessary. Running the same on a clean node:6 docker image I can clone the repo and run npm install without problems. Are you sure this is not because of some conflicting local .ssh or .git settings? That said - the build actually does not work for me ATM. I get a problem with the browserify step in my clean docker image. @HackbrettXXX - can you double-check?

zedtux commented 6 years ago

I'm missing the .map file, and before running npm run build, I need to install the dependencies.

I'm running a debian Jessie Docker image with my app which has a dependency on this library, so I have no configured .ssh or .git settings.

yGuy commented 6 years ago

Your node version is from the stone-age. Are you sure you want to be running npm 1.4?

$ docker run -it --rm node:6 bash root@4954590953a5:/# mkdir test && cd test root@4954590953a5:/test# git clone https://github.com/yWorks/jsPDF Cloning into 'jsPDF'... remote: Counting objects: 6598, done. remote: Total 6598 (delta 0), reused 0 (delta 0), pack-reused 6598 Receiving objects: 100% (6598/6598), 46.96 MiB | 5.81 MiB/s, done. Resolving deltas: 100% (3685/3685), done. Checking connectivity... done. root@4954590953a5:/test# cd jsPDF/ root@4954590953a5:/test/jsPDF# npm install jspdf-yworks@1.3.1 /test/jsPDF +-- accepts@1.3.3 +-- adler32cs@0.0.1 (git://github.com/chick307/adler32cs.js.git#c6576b4ed91b4216973bf85d8478a49970934515) +-- align-text@0.1.4 +-- amdefine@1.0.1

zedtux commented 6 years ago

Well I'm following what is running in prod right now. It is true it is a very old version, but unfortunately I can't upgrade it for now (I'm adding tests on the app before to migrate anything). 😞

yGuy commented 6 years ago

The build works with a decently recent version of npm and node: It is indeed missing a dependency on bower and bower only works in the official node docker image if you su node before you do anything, so I don't see the need to support node0.x anymore.

zedtux commented 6 years ago

Is there another way to get this .map file?

yGuy commented 6 years ago

Yes, there is: build it on a separate server that uses a current version of npm. Sorry, I don't think we should start supporting years old environments. You should update instead, IMHO.

zedtux commented 6 years ago

Thank you @yGuy I will do it in a Docker container 👍.

zedtux commented 6 years ago

Within the svg2pdf.js folder:

docker run -it --rm -v "$PWD":/devs -w /devs node:6 bash
npm install
npm run build

Then I copied the .map files. Thank you @yGuy.

HackbrettXXX commented 6 years ago

@yGuy I just tested the build. On a fresh clone it works locally on my PC. However, if I run it in a Docker, the build fails:

Error: Cannot find module 'SvgPath' from '/src'
    at /node_modules/browser-resolve/node_modules/resolve/lib/async.js:46:17
    at process (/node_modules/browser-resolve/node_modules/resolve/lib/async.js:173:43)
    at ondir (/node_modules/browser-resolve/node_modules/resolve/lib/async.js:188:17)
    at load (/node_modules/browser-resolve/node_modules/resolve/lib/async.js:69:43)
    at onex (/node_modules/browser-resolve/node_modules/resolve/lib/async.js:92:31)
    at /node_modules/browser-resolve/node_modules/resolve/lib/async.js:22:47
    at FSReqWrap.oncomplete (fs.js:123:15)

npm ERR! Linux 4.9.60-linuxkit-aufs
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "browserify"
npm ERR! node v6.13.1
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! svg2pdf.js@1.2.0 browserify: `browserify src/svg2pdf.js --debug -p licensify -s svg2pdf -o dist/svg2pdf.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the svg2pdf.js@1.2.0 browserify script 'browserify src/svg2pdf.js --debug -p licensify -s svg2pdf -o dist/svg2pdf.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the svg2pdf.js package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     browserify src/svg2pdf.js --debug -p licensify -s svg2pdf -o dist/svg2pdf.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs svg2pdf.js
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls svg2pdf.js
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /npm-debug.log

npm ERR! Linux 4.9.60-linuxkit-aufs
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
npm ERR! node v6.13.1
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! svg2pdf.js@1.2.0 build: `npm run browserify && npm run exorcist:svg2pdf && npm run uglify:dist`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the svg2pdf.js@1.2.0 build script 'npm run browserify && npm run exorcist:svg2pdf && npm run uglify:dist'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the svg2pdf.js package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run browserify && npm run exorcist:svg2pdf && npm run uglify:dist
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs svg2pdf.js
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls svg2pdf.js
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /npm-debug.log

The reason seems to be that browserify cannot resolve the "SvgPath"-dependency. A quick search didn't yield any solutions. I'll have a look at it again, soon.

yGuy commented 6 years ago

@HackbrettXXX - browserify will refuse to run under root - did you do a su node? Did you run all of this inside the docker instance or using a volume mapped to you local checkout? My last tests with node:6 succeeded.

HackbrettXXX commented 6 years ago

I ran it on a mapped folder and without "su node" (so probably as root, I'm no docker expert). But if it works for you now, I guess everything is fine.